Emoji in GNOME on Arch Linux
17 Oct 2019
Emoji 🚀 are ✨ great! ❤️ In a 🏠, with a 🐭, in a 📦, with a 🦊! The only places they really don’t belong are in the premise’s of movies, and CLIs (I’m looking at you, Kubernetes). One place I was sorely missing them though was on my Arch installation, until today that is.
For the uninitiated, under the hood, emoji are simply characters that were long-ago relegated to an unused corner of the Unicode table. As a result, this means two things for us; first, we’ll need to find a font that includes them, and that also means confronting…
fontconfig *cue: wilhelm scream*. Second, we’ll need a way of typing them. In hindsight, that’s more like two and a half to three things, but I digress.
Finding the perfect font
Fonts are like opinions in that opinions are like assholes; everybody has one. The only things that everyone can agree on are that Arial is just a cheap knockoff of Helvetica and that Comic Sans isn’t the problem, people who use Comic Sans in inappropriate contexts are, but all of that goes without saying. There a quite a few emoji fonts out there, actually. As an iOS user, I should naturally believe that Apple’s emoji are hands-down the best (And I do, they’re absolutely gorgeous!) but sadly, due to licensing I couldn’t possibly install them (And no, I’m not using San Francisco Mono as my system monospace font! What could possibly lead you to ask such a ridiculous yet poignant question?). The few fonts that I did actually try include
twemoji-color-font. Had I thought about it for half of a second and realized that Noto emoji is used by Android, I would’ve stopped myself right there. No offense, but it looks like the typographer drew them grasping their pen in a fist like a cartoon character.
Next stop, Twitter Color Emoji, Twitter’s open-source emoji font. I’ll admit it, I think it looks pretty good. Having been burned once not five minutes ago, I decided to give the
README a thorough go. Not even one quarter of a way into the document, I stumbled across this little gem:
Note: This requires Bitstream Vera is installed and will change your systems default serif, sans-serif and monospace fonts.…
DejaVuincludes a wide range of symbols which override the
Twitter Color Emojicharacters…
Bitstream Verais the source of the glyphs used in
DejaVu, 99%+ of people will not notice the difference.
You’d never guess, but I use DejaVu, and I quite like it, and I am one of the less-than-one percent who will notice the difference. So like any rational human being, I fire up
yay and installed it anyway, foolishly confident in my skills and ready to pit them against
fontconfig in glorious battle. After way more time than I should care to admit, I mostly had it worked out. Take that, RTFM! Happy as a clam, I carried on to the next step on my endeavour.
Selecting a Selector
As mentioned earlier, emoji are just characters, and so unless you’re Tom Scott, or don’t mind memorizing keycodes (I can’t find the forum post but yes, someone suggested that. I hope it was in jest 😰️), you’re going to want a way to select them graphically, preferably with some sort of search functionality included as well. Luckily for me, I use GNOME, which has an emoji picker built in that I knew nothing about and is apparently only documented in this Gitlab issue. Great! …except for the part where it only works, understandably, in Gtk applications. No worries, next stop, GNOME Shell Extensions! Everything useful in GNOME is à la carte these days it seems, and a system-wide emoji selector is no exception. Thankfully, there’s Emoji Selector, which includes a search feature! Hooray! Two clicks and we’re off to the races—oh no. Remember that quote from a paragraph ago that mentioned that DejaVu overrides Twitter Color Emoji but I thought I had fixed it? Turns out I hadn’t in this particular circumstance. And remember a paragraph ago where I had mentioned that I love Apple’s emoji but would NEVER violate their licensing? (If there any lawyers for Apple in the room, uh, you’re needed somewhere else) Ok, now that that’s taken care of, turns out that there’s an AUR package. I’m sure you’d never guess, again, dear reader, that in this twisting and turning tail there would be another turn, however this one is pretty minor. The conflicts list in the
PKGBUILD is actually ridiculous. A quick
4dd and a few more incantations (sans any StackOverflow searches, thank you very much), my eyes were met with the prettiest emoji my system ever did see!
Sadly, they were too beautiful for GNOME Shell it would seem, as in Emoji Selector they were rendered as silhouettes. UPDATE: Turns out I just needed to restart GNOME Shell. 🤷🏼♀️
All was not forgiven, though. I still had a couple of qualms about using a shell extension as an emoji selector: First, it couldn’t actually insert the emoji; it only copied them to the clipboard. You still had to manually paste them into whatever text buffer you were editing in. Second, the selector itself is just a popup menu item; it will always appear in the upper right corner of the screen, regardless of where the cursor is. This is admittedly a very minor quibble on the surface but for crying out loud this is a post about me wanting to be able to effortlessly spam my writing with modern-day hieroglyphs! Anyway, the fixed position of the selector almost never anywhere near where I’m typing really interrupts the flow of whatever context I might be in. It’d be much more preferable if the selector were able to be implemented as a drop-down list like other tools, such as autocomplete, do. After (I’ll admit it) some StackOverflowing, I stumbled across
ibus-typing-booster. I had some vague recollection of
IBus complaining about things way back when I used Ubuntu, but I never really knew what it did. I wish I had bothered to learn earlier because “Wow!” is it powerful!
Intelligent Input Bus is a multi-lingual input-method framework. Basically, it allows a user to easily input characters regardless of their keyboard’s physical layout. As we know, emoji are characters (I’m sorry I keep hammering that, but I’m always really excited by realizations that beneath the many layers of abstraction that modern computing sits upon, almost everything is incredibly mundane in implementation), meaning that it’s perfect for the job and, as icing on top,
IBus operates via a panel that’s rendered at the text cursor!
Installation (at least on Arch) proved to be a little obtuse, as it requires executing a program called
ibus-setup. *sigh* Maybe I’m just becoming curmudgeonly in my old age, but separate setup applications have always felt like an antipattern to me. Perhaps I’m naïve, but why not do whatever initial configuration is required during installation, or perform a check on every run? For a daemon especially, even having the user manually perform it would be preferable. Perhaps I’m only saying this because of what happened next, though. At the end of executing, a preference window opened with some configuration options and no obvious “save” or “cancel” buttons to be found. Upon closing the window and trying to setup
ibus-typing-booster, I was greeted with an error dialog stating that the
Ibus daemon wasn’t running. There wasn’t any mention of any
DBus service or
systemd unit to start. Did I miss something? Do I have to restart my session? I was consulting the Holy ArchWiki and the only nugget it offered was the suggestion that some environmental variables may need to be set, so I tried that, and restarted my session as part of it and sure enough,
IBus was up and running, but not knowing what action specifically solved the problem is frustrating, and may even cause trouble in the future if I need to fix anything. To be fair, I wasn’t being very scientific about it. I could have tried restarting my session first, but to be honest, I was getting a little tired. Having accomplished the necessary prerequisites, I turned to the matter of configuring
ibus-typing-booster. This may be another reason why, in retrospect, I may be unnecessarily critical of
IBus's documentation because I tip my hat to the creator of
ibus-typing-booster, Mike Fabian. His
README and documentation are my new gold standard to strive for in terms of communicating how to use the tools I make to others. The instructions are detailed but not incomprehensibly dense, and include screenshots! Even though the version of GNOME I use had buttons in slightly different places, seeing that the windows presented matched what was shown content-wise is a welcome relief when you’re deep in a sequence of steps.
I hope you enjoyed this tale of trials and tribulations. I think it highlights nicely that, as often is the case in Linux and in life, the first solution is rarely the best, and that experimentation can lead us to discovering solutions to problems we didn’t even knew we had. In the example of
IBus, I’ve been learning French and now will be exploring if it can help me with typing all of the accented vowels, c-cedillas, and guillemets more easily.
One side-effect of my desire to share what I learn with others is that it also really encourages me to go the extra mile to make sure what I come up with is well-polished. One such example is the instance of this mildly-irritating error initially given by
☹ en_US dictionary not found. Please install hunspell dictionary!
This would appear as the top suggestion (sometimes multiple times) no matter what I typed, and if I’m being perfectly honest, had I not written this article, I probably would’ve suffered for a quite a while until repeated incidents of accidentally selecting it for insertion would drive me to find a solution. But knowing that there was a chance I wouldn’t be the only person benefiting from the extra effort (and honestly taking solace in the fact that the solution to this problem
probably already exists on the internet), I fired up my search engine of choice and got to researching. Here’s what I found.
Hunspell is a spell checker based on MySpell that’s used in a surprising amount of software, according to their homepage.
ibus-typing booster uses it for completion prediction, thus requires dictionaries for any languages it’s used with. Installing a dictionary requires jumping through a few more hoops than usual if it isn’t in your distro’s package repos (Luckily everything is in Arch’s repos). The process is detailed in this StackOverflow post but the tl;dr of it is to download the desired dictionary from Apache OpenOffice Extensions, extract the
.otf file (It’s basically a
.zip file. You can actualyl just change the extension and use something like
unzip), and move the
.dic files to a directory on the
PATH given by
Honestly it might be more convenient to just install Arch.