dotfiles/bin/choose-emoji-menu
Gabriel Arazas cef34b86cb Add slop and newsboat config
I've also updated the Rofi config with my custom mode scripts.
Aside from that, I've finally took the time to recreate my file metadata
editing script.

Well, there's also the update of the README.
2020-09-17 23:55:09 +08:00

28 lines
1010 B
Bash
Executable File

#!/usr/bin/env sh
# 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
# Dependencies:
# * 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
emoji_file="${XDG_DATA_HOME:-HOME/.local/share}/emoji-list.txt"
if [[ ! -f $emoji_file ]]; then
notify-send "Downloading the emoji data file."
wget --output-document "$emoji_file" https://unicode.org/Public/emoji/13.0/emoji-test.txt
fi
selection=$(awk 'match($0, /([0-9A-F ]+)\s+; fully-qualified\s+# (\S+) E[[:digit:]]+.[[:digit:]]+ (.+)$/, a){print a[2], a[3]}' "$emoji_file" \
| rofi -dmenu -i -fuzzy -p "Choose an emoji to copy." \
| awk '{print $1}')
if [ -n "$selection" ]; then
printf "%s" "$selection" | xclip -selection clipboard && notify-send "'$(xclip -o -selection clipboard)' has been copied to clipboard."
fi