blob: b4c79d074c68c32152b35d0528be48dbb19c3fd5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/bin/sh
# From: https://git.sr.ht/~emersion/dotfiles/tree/6575f89856d012c2c31e9e7d2c807f350c7503d4/item/bin/emoji-menu
# This version uses `rofi script mode` instead of `fuzzel` or 'dmenu'.
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")"
# Copy selection to clipboard
if [ "$@" ]; then
wl-copy "$(echo -e "$@" | cut -d ' ' -f 1)"
exit 0
fi
# Display all options in menu
echo -e "$sel"
|