2026-01-12 - easy emoji under linux

recently i was wondering what's the best way to type in emoji under linux. some key bindings would be nice, to the common ones… and it turned out that using Wayland and sway DM it's very easy! :)

1st we need a script that's using wtype to simulate inserting characters from keyboard. e.g.:

#!/bin/bash
set -euo pipefail
for name in "$@"
do
  case "$name" in
    "cold_swet")     wtype "πŸ˜…" ;;
    "grimacing")     wtype "😬" ;;
    "grin")          wtype "😁" ;;
    "hushed")        wtype "😯" ;;
    "innocent")      wtype "πŸ˜‡" ;;
    "rotfl")         wtype "🀣" ;;
    "scream")        wtype "😱" ;;
    "skull")         wtype "πŸ’€" ;;
    "sunglasses")    wtype "😎" ;;
    "thinking")      wtype "πŸ€”" ;;
    "speak_no_evil") wtype "πŸ™Š" ;;
    "hear_no_evil")  wtype "πŸ™‰" ;;
    "see_no_evil")   wtype "πŸ™ˆ" ;;
    "spock")         wtype "πŸ––" ;;
    "thumbs_up")     wtype "πŸ‘" ;;
    "thumbs_down")   wtype "πŸ‘Ž" ;;
    "rocket")        wtype "πŸš€" ;;
    "poo")           wtype "πŸ’©" ;;
    "rolling_eyes")  wtype "πŸ™„" ;;
    "fire")          wtype "πŸ”₯" ;;
    "snowman")       wtype "β›„" ;;
    *)               wtype "?"  ;;
  esac
done

then add key bindings to Sway's config (i use right alt, as this is default for inserting polish national characters, too) in ~/.config/sway/config:

[...]
# emoji
bindsym Mod5+g       exec emoji grin
bindsym Mod5+shift+g exec emoji grimacing
bindsym Mod5+r       exec emoji rotfl
bindsym Mod5+Shift+r exec emoji rocket
bindsym Mod5+p       exec emoji spock
bindsym Mod5+Shift+p exec emoji poo
bindsym Mod5+t       exec emoji thinking
bindsym Mod5+h       exec emoji scream
bindsym Mod5+Shift+h exec emoji hushed
bindsym Mod5+u       exec emoji thumbs_up
bindsym Mod5+d       exec emoji thumbs_down
bindsym Mod5+l       exec emoji cold_sweat
bindsym Mod5+k       exec emoji skull
bindsym Mod5+j       exec emoji sunglasses
bindsym Mod5+i       exec emoji innocent
bindsym Mod5+y       exec emoji rolling_eyes
bindsym Mod5+f       exec emoji fire
bindsym Mod5+w       exec emoji snowman
[...]

…and off we go! :)

you might have noticed that not all emoji have a binding. that's ok, as you can still use the script from command line with e.g.: emoji fire and you get your character inserted where needed! :)

also a note – while in theory you could put wtype directly to Sway's config, it's make it harder to read, as there are no inline comments and in text mode, many emojis are hard to read or do not show at all (i.e. just a hex code).