summaryrefslogtreecommitdiff
path: root/.local/bin/dmenuunicode
diff options
context:
space:
mode:
authornic <ra@afu.re>2023-12-31 14:24:44 -0500
committernic <ra@afu.re>2023-12-31 14:24:44 -0500
commit84ee878342ebfa109ac547b91616eabbd7bfd30a (patch)
tree8fd84e3d9bece3700d7fec9b68ad13c4367384ec /.local/bin/dmenuunicode
Initial commit
Diffstat (limited to '.local/bin/dmenuunicode')
-rwxr-xr-x.local/bin/dmenuunicode18
1 files changed, 18 insertions, 0 deletions
diff --git a/.local/bin/dmenuunicode b/.local/bin/dmenuunicode
new file mode 100755
index 0000000..b25876f
--- /dev/null
+++ b/.local/bin/dmenuunicode
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# The famous "get a menu of emojis to copy" script.
+
+# Get user selection via dmenu from emoji file.
+chosen=$(cut -d ';' -f1 ~/.local/share/emoji | dmenu -i -l 30 | sed "s/ .*//")
+
+# Exit if none chosen.
+[ -z "$chosen" ] && exit
+
+# 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 type "$chosen"
+else
+ printf "$chosen" | xclip -selection clipboard
+ notify-send "'$chosen' copied to clipboard." &
+fi