Use Mac-style emoji on Linux

Splatmoji provides an easy way to spice up your communication with emoji.
63 readers like this.

Linux provides an amazing desktop experience by default. Although advanced users have the flexibility to choose their own window manager, the day-to-day flow of Gnome is better than ever since the GNOME 3.36 improvements. As a long-time Mac enthusiast turned Linux user, that's huge.

There is, however, one shortcut I use every day on a Mac that you won't find by default on Linux. It's a task I do dozens of times a day and an essential part of my digital communication. It's the emoji launcher.

You might laugh when you see that, but stick with me.

Most communication includes body language, and experts estimate upwards of 80% of what people remember comes from it. According to Advancement Courses' History of emoji, people have been using "typographical art" since the 1800s. It's indisputable that in 1881, Puck Magazine included four emotional faces for joy, melancholy, indifference, and astonishment. There is some disagreement about whether Abraham Lincoln's use of a winking smiley face, ;), in 1862 was a typo or an intentional form of expression. I could speculate further back into hieroglyphics, as this museum exhibit did. However you look at it, emoji and their ancestorial predecessors have conveyed complex human emotion in writing for a long time. That power is not going away.

Macs make it trivial to add these odd forms of expression to text with a shortcut to insert emoji into a sentence quickly. Pressing Cmd+Ctrl+Space launches a menu, and a quick click completes the keystroke.

GNOME does not (yet) have this functionality by default, but there is open source software to add it.

My first attempts at emoji on Linux

So how can you add emoji-shortcut functionality to a Linux window manager? I began with trial and error. I tried about a dozen different tools along the way. I found Autokey, which has been a great way to insert text using shortcuts or keywords (and I still use for that), but the emoji extension did not render for me (on Fedora or Pop!_OS). I hope one day it does, so I can use colon notation to insert emoji, like :+1: to get a ?️.

It turns out that the way emoji render and interact with font choices throughout a window manager is nontrivial. Partway through my struggle, I reached out to the GNOME emoji team (yes, there's a team for emoji!) and got a small taste of its complexity.

I did, however, find a project that works consistently across multiple Linux distributions. It's called Splatmoji.

Splatmoji for inserting emoji

Splatmoji lets me consistently insert emoji into my Linux setup exactly like I would on a Mac. Here is what it looks like in action:

It's written in Bash, which is impressive for all that it does. Splatmoji depends on a pretty interesting toolchain outside of Bash to avoid a lot of complexity in its main features. It uses:

  • rofi to provide a smooth window-switcher experience
  • xdotool to input the keystrokes into the window
  • xsel or xclipboard to copy the selected item
  • jq, a JSON processor, if JSON escaping is called

Thanks to these dependencies, Splatmoji is a surprisingly straightforward tool that calls these pieces in the right order.

Set up Splatmoji

Splatmoji offers packaged releases for dnf and apt-based systems, but I set it up using the source code to keep up with the latest updates to the project:

# Go to whatever directory you want to store the source code.
# I keep everything in a ~/Development folder, and do so here.
# Note that `mkdir -p` will make that folder if you haven't already.
$ mkdir -p ~/Development
$ cd ~/Development
$ git clone https://github.com/cspeterson/splatmoji
$ cd splatmoji/

Install the requirements above using the syntax for your package manager. I usually use Homebrew and add /home/linuxbrew/.linuxbrew/bin/ to my path, but I will use dnf for this example:

$ sudo dnf install rofi xdotool xsel jq

Test it out:

$ cd ~/Development/splatmoji/
$ ./splatmoji copy

If everything is installed correctly, you should see a pop-up window where you can select an emoji. Selecting it will add the emoji to your clipboard. Use Ctrl+V to paste it.

Set a shortcut to emoji

Installing the software is the first part, but the benefit comes from having a shortcut to insert expressive emoji.

Splatmoji offers a shortcut for i3wm users, but I use the default of GNOME. To set it up:

  • Navigate to Settings > Keyboard > Keyboard Shortcuts.
  • Click Customize Shortcuts > Add Shortcut.
  • Add a name (I chose Emoji Launcher).
  • Add the command.*
  • Click Set Shortcut, and choose your combination (I chose Ctrl+Alt+Space to mimic a Mac). 

* The command has to be exactly what you want Gnome to run. If you've followed along with the tutorial so far, use the path to the splatmoji repository you cloned above. YOURUSER is the folder name for your user. Run pwd in the Splatmoji folder to be absolutely sure.

/home/YOURUSER/Development/splatmoji/splatmoji copypaste

Note that the command includes splatmoji twice because it's both the folder name and the script name (that took me a few hours of troubleshooting to notice). If you did this correctly, you should be able to hit your shortcut and see the emoji picker.

Choose more options

There are many ways to customize your setup.

You may have noticed the copypaste part of the command above. I prefer this command argument because it gives me both an immediately pasted emoji and the option to paste more of them with additional Ctrl+V shortcuts (a feature the Mac doesn't have!). Here are the options:

Positional arguments:
    [copy|type|copypaste]
        This application can place the final selection into the user's
        clipboard (copy), type it out for the user (type), or place the final
        selection into the user's clipboard and paste it out for the user with
        a configured key combo (copypaste).

Beyond this, I stick with Splatmoji's defaults, but you might want to change the default language using -l or the emoji skin tone with -s:

# Pulling helpful commands out of the man page
# Run `splatmoji -h` for all options
  Flags:
      -l, --languages LANG1,LANG2,LANG3
        With emoji from the included database, it is possible to specify
        keyword/annotation languages to include in addition to `en`. `nn`
        for Norwegain, `fr-CA` for Canadian French, etc. In theory this could
        apply to both emoji *and* emoticons, but the emoticons only come in
        English at the moment.  Default: en

        -s, --skin-tones [light,medium-light,medium,medium-dark,dark]
        Fitzpatrick scale skin tones to display for emoji that can be modified
        by such. If given, emoji containing any other skin tones will be
        omitted from the choice list.

Add each flag, as desired, to the shortcut you made earlier. For instance, if I were a French speaker who uses dark tones on the Fitzpatrick scale and prefers only to copy the emoji (and not paste it), my command would be:

/home/YOURUSER/Development/splatmoji/splatmoji -l fr -s dark copy

Put it together

Many people appreciate emoji, and many people don't. Whether you love these digital annotations or not, they have a rich history of relevance in communication, and they are not going away anytime soon.

Splatmoji provides a path to a shortcut emoji picker akin to what a Mac offers. What stands out is how much customization is available, making it an even more effective tool for those who like to tinker. Install the tool and its dependencies, then set yourself up for easy emoji picking in the future. ?

What to read next
Tags
I'm happiest at a microphone
Matt was an EMC storage expert, VMware vExpert, and former fan of other proprietary technologies. He now focuses on open source and DevRel adoption.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.