summaryrefslogtreecommitdiff
path: root/bin/guiscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-xbin/guiscripts/stplumb29
-rwxr-xr-xbin/guiscripts/sturl11
2 files changed, 29 insertions, 11 deletions
diff --git a/bin/guiscripts/stplumb b/bin/guiscripts/stplumb
new file mode 100755
index 0000000..1898bd1
--- /dev/null
+++ b/bin/guiscripts/stplumb
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+select_link() {
+ regex='(((file|https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;!a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
+ tr -d '\n' | grep -Eo "$regex" | dmenu -n -x -c
+}
+
+case $1 in
+'copylink')
+ url="$(select_link)"
+ [ "$url" ] || exit 1
+ printf '%s' "$url" | clipp
+ ;;
+'open')
+ url="$(select_link)"
+ [ "$url" ] || exit 1
+ lh "$url"
+ ;;
+'copypath')
+ path="$(grep -Eo -e '/([^/ ](/?)+)+' -e '[^ /]+/+([^ /]+(/?)+)*' |
+ sort | uniq | dmenu -n -x -c)"
+ [ "$path" ] || exit 1
+ printf '%s' "$path" | clipp
+ ;;
+*)
+ echo "no option"
+ exit 1
+ ;;
+esac
diff --git a/bin/guiscripts/sturl b/bin/guiscripts/sturl
deleted file mode 100755
index 2712d92..0000000
--- a/bin/guiscripts/sturl
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-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" | commander -xcl)"
-[ -z "$url" ] && exit 1
-
-case $1 in
- 'c') printf '%s' "$url" | clipp ;;
- 'o') lh "$url" ;;
- *) echo "no option" ;;
-esac