commit a0f287f5116ff7e6bd36636e1c61fc726287f2f4
parent 211918b9ffac4a73f779075f54a43fe860d4c140
Author: hhvn <hayden@haydenvh.com>
Date: Fri, 19 Feb 2021 19:41:48 +0000
.scripts/bin/urlhand .scripts/bin/urlhand2: streamline
Diffstat:
2 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/.scripts/bin/urlhand b/.scripts/bin/urlhand
@@ -1,10 +1,8 @@
#!/bin/sh
-link=$(grep -Eo '[A-Za-z][A-Za-z]*://[^ >),]*' < /dev/stdin 2>/dev/null | awk '{print $1}' | dmenu -i)
+link=$(grep -Eo '[A-Za-z][A-Za-z]*://[^ ]*' < /dev/stdin 2>/dev/null | sed 's/[>,:)]$//' | dmenu -i)
[ "$link" = "" ] && exit 1
-tor=$(printf "no\nyes" | dmenu -i -p "Tor?")
-
hand=$(printf "mpvms video
mpvms
mpv --pause
@@ -16,6 +14,16 @@ toxclip
netimg
netvid
popupcurl
-popupcgo" | dmenu -i)
+popupcgo
+torsocks mpvms video
+torsocks mpvms
+torsocks mpv --pause
+torsocks popupmpv
+torsocks youtube-dl --add-metadata -ic
+torsocks youtube-dl --add-metadata -xic
+torsocks $(xprop -id $(cat /tmp/tabbed.xid) >/dev/null && echo "surf -e $(cat /tmp/tabbed.xid)" || echo ">/tmp/tabbed.xid tabbed -cr2 surf -e ''")
+torsocks netimg
+torsocks popupcurl
+torsocks popupcgo" | dmenu -i)
-[ "$tor" = "yes" ] && sh -c "torsocks $hand $link" || sh -c "$hand $link"
+sh -c "$hand $link"
diff --git a/.scripts/bin/urlhand2 b/.scripts/bin/urlhand2
@@ -1,18 +1,3 @@
#!/bin/sh
-tor=$(printf "no\nyes" | dmenu -i -p "Tor?")
-
-hand=$(printf "mpvms video
-mpvms
-mpv --pause
-popupmpv
-youtube-dl --add-metadata -ic
-youtube-dl --add-metadata -xic
-$(xprop -id $(cat /tmp/tabbed.xid) >/dev/null && echo "surf -e $(cat /tmp/tabbed.xid)" || echo ">/tmp/tabbed.xid tabbed -cr2 surf -e ''")
-toxclip
-netimg
-netvid
-popupcurl
-popupcgo" | dmenu -i)
-
-[ "$tor" = "yes" ] && sh -c "torsocks $hand $1" || sh -c "$hand $1"
+echo "$@" | $(dirname $0)/urlhand