Universal emoji selection with dmenu

Universal emoji selection with dmenu

ยท

4 min read

Windows 10 has this nice little emoji selector which can be spawned with the Windows logo key + . (period) wouldn't it be cool if you could get the same in you GNU/Linux machine without building some stupid binaries with many dependencies?? or even better a frikkin one liner????

well fret not my friend for I have already done the hard work of scourging random GitHub profiles and putting together the perfect solution!

emojiselector.png

btw if you wanna just skip to the goodies you can find them ๐Ÿ‘‰ here

Stuff you'll need

dmenu for the menu lol

optional

xclip for piping into the system clipboard so that you can paste that baby anywhere libnotify for notification, again, totally, optional,

all of which can be found in your distro's standard repos if not already installed on your machine.

once you have the aforementioned thingies set up and running we can move into the code but remember all of this can be easily replaced with similar programs cuz - extensibility lol

Code

the emoji list can be found in my Github gist gist.github.com/itzjustalan/2a719482af601cb..

cat ~/.config/emoji-list | dmenu | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard

here cat takes the emoji-list file and provides that as standard input to dmenu dmenu reads every line as an option for the user to search through and choose from awk prints the first column ( colums are seperated with spaces) tr trims out the trailing new line xclip puts our selected emoji into the system clipboard

if you have installed sxhkd you can map this into the sxhkdrc like this to spawn this where ever you are

super + period
  cat ~/.config/emoji-list | dmenu | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard

bonus

but if you are like me you might wanna put this into a separate file called emojiselect run a chmod +x on it and added it to path before adding another line to get a notification on the selected emoji then change the sxhkdrc to execute the file instead of our one liner here is my file -

selection=$(cat ~/.config/emoji-list | dmenu -b -l 30)
echo $selection | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
notify-send "$selection"

where the -b makes the menu come from the bottom and -l specifies number of options/lines to show

Thank you!

sources

emoji-list and inspiration