2020-01-20 09:18:40 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2020-09-10 19:12:26 +00:00
|
|
|
# Simply create a universal emoji selection list.
|
|
|
|
# The emoji list should be the following file:
|
|
|
|
# https://unicode.org/Public/emoji/13.0/emoji-test.txt
|
2020-01-20 09:18:40 +00:00
|
|
|
|
2020-09-10 19:12:26 +00:00
|
|
|
# Dependencies:
|
2020-01-20 09:18:40 +00:00
|
|
|
# * mktemp - GNU coreutils 8.31
|
|
|
|
# * wget - GNU Wget 1.20.3 built on linux-gnu
|
|
|
|
# * sed - GNU sed 4.8
|
|
|
|
# * awk - GNU Awk 5.0.1
|
|
|
|
# * rofi - Version: 1.5.4
|
|
|
|
# * xclip - version 0.13
|
|
|
|
|
2020-09-17 15:55:09 +00:00
|
|
|
emoji_file="${XDG_DATA_HOME:-HOME/.local/share}/emoji-list.txt"
|
2020-09-10 19:12:26 +00:00
|
|
|
if [[ ! -f $emoji_file ]]; then
|
2020-09-17 15:55:09 +00:00
|
|
|
notify-send "Downloading the emoji data file."
|
2020-09-10 19:12:26 +00:00
|
|
|
wget --output-document "$emoji_file" https://unicode.org/Public/emoji/13.0/emoji-test.txt
|
|
|
|
fi
|
|
|
|
|
2020-05-01 14:45:31 +00:00
|
|
|
selection=$(awk 'match($0, /([0-9A-F ]+)\s+; fully-qualified\s+# (\S+) E[[:digit:]]+.[[:digit:]]+ (.+)$/, a){print a[2], a[3]}' "$emoji_file" \
|
2020-05-21 15:16:15 +00:00
|
|
|
| rofi -dmenu -i -fuzzy -p "Choose an emoji to copy." \
|
2020-09-10 19:12:26 +00:00
|
|
|
| awk '{print $1}')
|
2020-03-25 16:41:57 +00:00
|
|
|
|
2020-04-29 15:58:14 +00:00
|
|
|
if [ -n "$selection" ]; then
|
2020-06-02 14:53:56 +00:00
|
|
|
printf "%s" "$selection" | xclip -selection clipboard && notify-send "'$(xclip -o -selection clipboard)' has been copied to clipboard."
|
2020-03-25 16:41:57 +00:00
|
|
|
fi
|