#!/bin/bash # source for emoji-test.txt: # https://unicode.org/Public/latest/emoji/emoji-test.txt # there is also a .desktop file for this script if mkdir ~/.config/tofi/tofi_emoji_cache &>/dev/null ; then cd ~/.config/tofi/tofi_emoji_cache || exit 1 echo "creating cache..." wget 'https://unicode.org/Public/latest/emoji/emoji-test.txt' || exit 1 cat ~/.config/tofi/emoji-test.txt \ | sed -rEn 's/^[^;]+;\s*(\S+)\s*#\s*(\S+)\s+\S+\s+(.*)$/; [\1];\2;\3/ ; s/;( \[fully-qualified\]|([^;]*));([^;]*);(.*)/\3 \4\2/p' \ > emojis.txt fi cat ~/.config/tofi/tofi_emoji_cache/emojis.txt \ | tofi --history-file="$HOME/.config/tofi/tofi_emoji_cache/history" "$@" \ | grep -Eo '^\S+' \ | tr -d '\r\n\t' \ | wl-copy