From 8986d060f2f308ba768758ef9c3077f00f3d6b2a Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 23 Jun 2024 14:12:17 +0200 Subject: checkpoint --- bin/guiscripts/stplumb | 29 +++++++++++++++++++++++++++++ bin/guiscripts/sturl | 11 ----------- 2 files changed, 29 insertions(+), 11 deletions(-) create mode 100755 bin/guiscripts/stplumb delete mode 100755 bin/guiscripts/sturl (limited to 'bin/guiscripts') 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 -- cgit v1.2.3