summaryrefslogtreecommitdiff
path: root/.local/bin/dmenuhandler
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2022-02-03 22:22:11 -0500
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-02-03 22:28:08 -0500
commit7888574b1c18c77b75e5c6c5930cd0709f16898a (patch)
treeed4214ac5696c5641a1d8e3d335d68f7ca72f6d2 /.local/bin/dmenuhandler
parent7434b9127257627a48b7520effd46fb389f1fddd (diff)
Catching upHEADmaster
Diffstat (limited to '.local/bin/dmenuhandler')
-rwxr-xr-x.local/bin/dmenuhandler21
1 files changed, 21 insertions, 0 deletions
diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler
new file mode 100755
index 0000000..e5de8ef
--- /dev/null
+++ b/.local/bin/dmenuhandler
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Feed this script a link and it will give dmenu
+# some choice programs to use to open it.
+feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
+
+case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in
+ "copy url") echo "$feed" | xclip -selection clipboard ;;
+ mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
+ "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
+ "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
+ "queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;;
+ "queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;;
+ "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
+ PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
+ sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
+ vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
+ setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
+ browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
+ lynx) lynx "$feed" >/dev/null 2>&1 ;;
+esac