diff options
| author | Justine Smithies <justine@smithies.me.uk> | 2026-03-05 19:52:59 +0000 |
|---|---|---|
| committer | Justine Smithies <justine@smithies.me.uk> | 2026-03-05 19:52:59 +0000 |
| commit | 9c3ebc98caf9e8ad4c71c148d05b8f48460b6f9a (patch) | |
| tree | f9547fb859f9d60c93501fd7d20a4e02869a3a42 /.local/bin/emoji-menu.sh | |
| parent | f6cf81adc737a5506b33bf133fa367041b352b98 (diff) | |
Add emoji-menu.sh
Diffstat (limited to '.local/bin/emoji-menu.sh')
| -rwxr-xr-x | .local/bin/emoji-menu.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.local/bin/emoji-menu.sh b/.local/bin/emoji-menu.sh new file mode 100755 index 0000000..f783402 --- /dev/null +++ b/.local/bin/emoji-menu.sh @@ -0,0 +1,17 @@ +#!/bin/sh -eu +# From: https://git.sr.ht/~emersion/dotfiles/tree/6575f89856d012c2c31e9e7d2c807f350c7503d4/item/bin/emoji-menu + +default_cache_home=~/.cache +cache_home="${XDG_CACHE_HOME:-$default_cache_home}" +mkdir -p "$cache_home" +data_file="$cache_home/emoji-menu.json" + +if ! [ -f "$data_file" ]; then + curl -o "$data_file" -L "https://github.com/github/gemoji/raw/master/db/emoji.json" +fi + +filter='.[] | (.emoji + " " + .description + " (" + (.aliases | join(", ")) + ")")' +sel="$(jq -r "$filter" <"$data_file" | rofi -i -dmenu -mesg "Emoji Menu" | cut -d ' ' -f 1 | tr -d '\n')" +if [ -n "$sel" ]; then + printf "$sel" | xclip -selection clipboard +fi |
