voidrice/.local/bin/dmenuunicode

19 lines
545 B
Text
Raw Normal View History

#!/bin/sh
2019-11-23 19:26:35 +00:00
# The famous "get a menu of emojis to copy" script.
2018-10-29 19:01:24 +00:00
2020-05-02 19:03:20 +00:00
# Get user selection via dmenu from emoji file.
2022-07-08 17:01:53 +00:00
chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | dmenu -i -l 30 | sed "s/ .*//")
2018-10-29 19:01:24 +00:00
2020-05-02 19:03:20 +00:00
# Exit if none chosen.
[ -z "$chosen" ] && exit
2020-05-02 19:03:20 +00:00
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
2020-05-02 19:03:20 +00:00
xdotool type "$chosen"
else
2021-02-28 21:08:51 +00:00
printf "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
fi