2020-02-08 23:43:37 +00:00
|
|
|
#!/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.
|
|
|
|
chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | 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
|
2018-11-04 21:16:37 +00:00
|
|
|
|
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.
|
2020-02-09 14:15:58 +00:00
|
|
|
if [ -n "$1" ]; then
|
2020-05-02 19:03:20 +00:00
|
|
|
xdotool type "$chosen"
|
2020-02-09 14:15:58 +00:00
|
|
|
else
|
2021-02-28 21:08:51 +00:00
|
|
|
printf "$chosen" | xclip -selection clipboard
|
2020-02-09 14:15:58 +00:00
|
|
|
notify-send "'$chosen' copied to clipboard." &
|
|
|
|
fi
|