how to: emoji support on linux

yeah

input

basically use ibus-uniemoji: https://github.com/salty-horse/ibus-uniemoji

if you're on manjaro, you can install ibus-uniemoji from the AUR and also go ahead and install the optional dep python-levenshtein. on other distros look for an ibus-uniemoji package, and if there is not one you can do the evil make && sudo make install from source or try to package it yourself. i've never really tried to do anything like that

to enable ibus-uniemoji on GNOME, log out and back in, then in the GNOME settings / region and language add uniemoji (in + > other > uniemoji)

GNOME preferences pane showing input methods

now use super+space to switch between your regular input method and uniemoji

it looks like this πŸ¦ˆπŸ“ˆ

demonstration of the uniemoji input method inserting emoji into this blog post

on KDE it's a bit more obtuse. enable the following in /etc/environment

GTK_IM_MODULE=ibus
XMODIFIERS=@im=ibus
QT_IM_MODULE=ibus

log out and back in for that to apply, and ensure that ibus-daemon --xim gets started in your session, which happens automatically on manjaro. if you need to start it manually, use ibus-daemon --xim -d. there should be a tray icon for ibus, use that to open ibus settings and add uniemoji as an input method. now you should be good to go

for other desktop amalgamations i assume the KDE methodology will also work

output

i always just use the noto color emoji fonts (noto-fonts-emoji). there are alternatives, look in your distro package manager for any color emoji packages. if you use a distro that does the font-config stuff for you then you're good to go, except for firefox sometimes which doesn't listen because firefox. though i don't think i've had any issues with firefox for most of this year so perhaps something got fixed with that

terminal

most modern terminals have good support for emoji. don't use st, because st apparently crashes when i send an st user an emoji over IRC. quality softwareβ„’

demo of a bunch of shark emoji in GNOME terminal

bonus points: LaTeX

sometimes you want to show off your fancey color emoji to other people via the worst document format ever invented (also known as "PDF")

you'll need absolute latest bleeding edge LuaLaTeX with support for harfbuzz rendering. this means a 2020 texlive version because this feature literally just got added to mainline releases this year. eg

$ lualatex --version
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/Arch Linux)

then you need to convince it really hard to do the thing by adding manual exceptions for every emoji (there may be a better way - let me know)

$ cat > test.tex <<EOF
\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}
\newfontfamily{\emojifont}{Noto Color Emoji}[Renderer=Harfbuzz]
\DeclareTextFontCommand{\textemoji}{\emojifont}
\newunicodechar{πŸ§ƒ}{\textemoji{πŸ§ƒ}}
\newunicodechar{🦈}{\textemoji{🦈}}
\begin{document}

i am a 🦈

\end{document}
EOF

$ latexmk -pdflatex=lualatex -pdf test.tex

it looks like this

demo of the output, showing a color emoji shark emoji on the generated PDF

fin

:wq