summaryrefslogtreecommitdiff
path: root/bin/guiscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-xbin/guiscripts/dmvid2
-rwxr-xr-xbin/guiscripts/linkhandler5
-rwxr-xr-xbin/guiscripts/sturl13
3 files changed, 12 insertions, 8 deletions
diff --git a/bin/guiscripts/dmvid b/bin/guiscripts/dmvid
index ee7f865..16e164f 100755
--- a/bin/guiscripts/dmvid
+++ b/bin/guiscripts/dmvid
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-find ${1:-~/movies ~/Downloads} 2> /dev/null | grep -E ".+\.(webm|mp4|mpeg|mkv)$" | sort > /tmp/dmvids
+find ${1:-~/vids ~/dl} 2> /dev/null | grep -E ".+\.(webm|mp4|mpeg|mkv)$" | sort > /tmp/dmvids
choice="$(\
sed 's|^/home/aluc|\~| ; s|\([^/]\)[^/]*/|\1/|g' /tmp/dmvids \
| awk '{printf "%s %s\n", NR ":", $0}' \
diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/linkhandler
index a3a6b64..da2d656 100755
--- a/bin/guiscripts/linkhandler
+++ b/bin/guiscripts/linkhandler
@@ -6,11 +6,8 @@
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
-if [ -z "$1" ]; then
+test -z "${url:=$1}" &&
url="$(xclip -sel c -o)"
-else
- url="$1"
-fi
dunstify "linkhandler" "<b>handling</b> $url"
case "$url" in
diff --git a/bin/guiscripts/sturl b/bin/guiscripts/sturl
index f7a3956..bf1fb02 100755
--- a/bin/guiscripts/sturl
+++ b/bin/guiscripts/sturl
@@ -1,4 +1,11 @@
#!/bin/sh
-regex='\(ipfs:\|ipns:\|magnet:\|mailto:\|gemini:\|gopher:\|https:\|http:\|news:\|file:\|git:\|ssh:\|ftp:\)[^\<>"{-}\^`]\+'
-url="$(grep "$regex" | sort | uniq | dmenu -g 1 -l 10 -x -c)"
-linkhandler $url
+
+regex='(((https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
+url="$(cat | tr -d '\n' | grep -Eo "$regex" | dmenu -x -c -g 1 -l 10)"
+[ -z "$url" ] && exit 1
+
+case $1 in
+ 'c') echo -n "$url" | xclip -sel c -r ;;
+ 'o') linkhandler "$url" ;;
+ *) echo "no option" ;;
+esac