summaryrefslogtreecommitdiff
path: root/.local/bin/emoji
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2021-06-10 08:05:06 +0000
committer0scar <qgt268@alumni.ku.dk>2021-06-10 08:05:06 +0000
commit7ad685aa6bd77d76115132280ce323d7fc5aeeb0 (patch)
treec605992dfb5582a050b8847eb624fa84f1f97d91 /.local/bin/emoji
parent6e4a15d79352ca2707a3b0d81d158228a7d14704 (diff)
Add scripts
Diffstat (limited to '.local/bin/emoji')
-rwxr-xr-x.local/bin/emoji19
1 files changed, 19 insertions, 0 deletions
diff --git a/.local/bin/emoji b/.local/bin/emoji
new file mode 100755
index 0000000..7cb7bbf
--- /dev/null
+++ b/.local/bin/emoji
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+# The famous "get a menu of emojis to copy" script.
+
+# Get user selection via dmenu from emoji file.
+chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -fn DejaVuSansMono\ Nerd\ Font -i -l 30 | sed "s/ .*//")
+#chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -fn JoyPixels -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
+ echo "$chosen" | tr -d '\n' | xclip -selection clipboard
+ notify-send "'$chosen' copied to clipboard." &
+fi