summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmenuunicode
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-05-02 15:03:20 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-05-02 15:03:20 -0400
commit50baa1a44f74206f6848fb55009439800e9b8965 (patch)
tree67c441cecfe92e6b9f69d248fe6dca014a70b24e /.local/bin/dmenuunicode
parent833d5fe9b7ced38d8484844977e7ec8347c06fb4 (diff)
downloadeibhear-50baa1a44f74206f6848fb55009439800e9b8965.tar.gz
eibhear-50baa1a44f74206f6848fb55009439800e9b8965.tar.zst
eibhear-50baa1a44f74206f6848fb55009439800e9b8965.zip
use xdotool type
Diffstat (limited to '.local/bin/dmenuunicode')
-rwxr-xr-x.local/bin/dmenuunicode14
1 files changed, 7 insertions, 7 deletions
diff --git a/.local/bin/dmenuunicode b/.local/bin/dmenuunicode
index 15799a3..de1421b 100755
--- a/.local/bin/dmenuunicode
+++ b/.local/bin/dmenuunicode
@@ -2,16 +2,16 @@
# The famous "get a menu of emojis to copy" script.
-# Must have xclip installed to even show menu.
-xclip -h 2>/dev/null || exit 1
+# Get user selection via dmenu from emoji file.
+chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 30 | sed "s/ .*//")
-chosen=$(cut -d ';' -f1 ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//")
+# Exit if none chosen.
+[ -z "$chosen" ] && exit
-[ "$chosen" != "" ] || exit
-
-# If you run this command with an argument, it will automatically insert the character.
+# 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
- xdotool key Shift+Insert
+ xdotool type "$chosen"
else
echo "$chosen" | tr -d '\n' | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &