emote shell scripts
[dotfiles.git] / Scripts / emoter
diff --git a/Scripts/emoter b/Scripts/emoter
new file mode 100755 (executable)
index 0000000..c7f199e
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+emote_dir="$HOME/Downloads/emotes"
+
+mode="image/png"
+[ "$1" = "-g" ] && mode="image/gif"
+
+emote_name="$(ls $emote_dir | grep -E '\.png$|\.jpeg$|\.jpg' | dmenu)"
+[ ! -f "$emote_dir/$emote_name" ] && exit 0
+
+echo "$emote_dir/$emote_name" | \
+     xargs xclip -selection clipboard -t "$mode" -i
+
+# now paste the image
+xdotool getactivewindow key ctrl+v
+xdotool getactivewindow key --delay 250 KP_Enter
+