summaryrefslogtreecommitdiff
path: root/bin/guiscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-xbin/guiscripts/linkhandler8
-rwxr-xr-xbin/guiscripts/sturl6
2 files changed, 10 insertions, 4 deletions
diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/linkhandler
index aeec202..329e267 100755
--- a/bin/guiscripts/linkhandler
+++ b/bin/guiscripts/linkhandler
@@ -11,6 +11,12 @@ test -z "${url:=$1}" &&
dunstify "linkhandler" "<b>handling</b> $url"
case "$url" in
+ file://*) file="${url##file:/}"
+ case "$(file -bi "$file" | cut -f1 -d'/')" in
+ audio|video) mpv "$file" ;;
+ image) imv "$file" ;;
+ *) xdg-open "$file" ;;
+ esac ;;
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
setsid -f mpv --quiet --ytdl --ytdl-raw-options="format-sort=res:720" "$url" > /dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif)
@@ -18,7 +24,7 @@ case "$url" in
*pdf|*cbz|*cbr)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && $VIEWER "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)
- qndl "$url" 'curl -LO' >/dev/null 2>&1 ;;
+ mpv "$url" 'curl -LO' >/dev/null 2>&1 ;;
*)
if [ -f "$url" ]
then setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1
diff --git a/bin/guiscripts/sturl b/bin/guiscripts/sturl
index c738c8e..5b8b1e7 100755
--- a/bin/guiscripts/sturl
+++ b/bin/guiscripts/sturl
@@ -1,11 +1,11 @@
#!/bin/sh
-regex='(((https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
-url="$(tr -d '\n' | grep -Eo "$regex" | dmenu -x -c -g 1 -l 10)"
+regex='(((file|https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
+url="$(tr -d '\n' | grep -Eo "$regex" | tac | commander -cl)"
[ -z "$url" ] && exit 1
case $1 in
- 'c') echo -n "$url" | xclip -sel c -r ;;
+ 'c') printf '%s' "$url" | xclip -sel c -r ;;
'o') linkhandler "$url" ;;
*) echo "no option" ;;
esac