Create a emoji-picker in dmenu

awalariansyah

Awal Ariansyah

Posted on January 9, 2023

Create a emoji-picker in dmenu

One of the nice things I have in Windows is that when I pressed windows + ., the emoji picker shows up. When I moved to linux distros as a daily driver, I kinda missed that features.

You can use others packages or use IBus, but I would like some cleaner approach. This approach is presented by Luke Smith, check out his cool youtube: https://www.youtube.com/watch?v=UCEXY46t3OA.

I'm assuming you're already installed dmenu on your system.

Get all the emoji

mkdir ~/dmenu
cd dmenu

curl https://gist.githubusercontent.com/Caellian/947e9b7b0f9d42278b9308765dc4ec08/raw/66a8b264732b4da40970cb3c57df02118e47cb2b/update.sh | sh
Enter fullscreen mode Exit fullscreen mode

We make a directory and then use this nice script by Caellian to collect all available emojis and format it.

You'll see a file named "emoji_list". That's the file we're going to insert into dmenu.

Image description

Make the script

touch dmenuemoji.sh
chmod +x dmenuemoji.sh
Enter fullscreen mode Exit fullscreen mode

We created a file dmenuemoji.sh, open it with your favorite editor.

Paste the script by Luke Smith below.

#!/bin/sh

grep -v "#" emoji_list | dmenu -i -l 20 | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard

pgrep -x dunst >/dev/null && notify-send "$(xclip -o -selection clipboard) Copied!"
Enter fullscreen mode Exit fullscreen mode

Don't forget to bind it with a keyboard shortcut.

You can edit the script, for example your preferred dmenu layout or your clipboard app. Here's my final result:

Image description

My final script:

#!/bin/sh
grep -v "#" emoji_list | dmenu -c -i -l 15 | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard;

if [ -n "$(xclip -o -selection clipboard)" ]; then
notify-send "Emoji copied" "$(xclip -o -selection clipboard) successfully copied!" --icon=dialog-information;
fi
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
awalariansyah
Awal Ariansyah

Posted on January 9, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Create a emoji-picker in dmenu
linux Create a emoji-picker in dmenu

January 9, 2023