2020-02-08 18:43:37 -05:00
|
|
|
#!/bin/sh
|
2019-11-23 14:26:35 -05:00
|
|
|
|
|
|
|
# The famous "get a menu of emojis to copy" script.
|
2018-10-29 15:01:24 -04:00
|
|
|
|
2020-05-02 15:03:20 -04:00
|
|
|
# Get user selection via dmenu from emoji file.
|
2022-07-08 13:01:53 -04:00
|
|
|
chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | dmenu -i -l 30 | sed "s/ .*//")
|
2018-10-29 15:01:24 -04:00
|
|
|
|
2020-05-02 15:03:20 -04:00
|
|
|
# Exit if none chosen.
|
|
|
|
[ -z "$chosen" ] && exit
|
2018-11-04 21:16:37 +00:00
|
|
|
|
2020-05-02 15:03:20 -04: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.
|
2020-02-09 09:15:58 -05:00
|
|
|
if [ -n "$1" ]; then
|
2020-05-02 15:03:20 -04:00
|
|
|
xdotool type "$chosen"
|
2020-02-09 09:15:58 -05:00
|
|
|
else
|
2021-02-28 23:08:51 +02:00
|
|
|
printf "$chosen" | xclip -selection clipboard
|
2020-02-09 09:15:58 -05:00
|
|
|
notify-send "'$chosen' copied to clipboard." &
|
|
|
|
fi
|