diff options
| author | root <root@bengtsson.win> | 2021-12-27 08:56:27 +0000 |
|---|---|---|
| committer | root <root@bengtsson.win> | 2021-12-27 08:56:27 +0000 |
| commit | c568b7c9e5c35570644932db6125e1d9b3aadf4a (patch) | |
| tree | 474fe9d8487254f8a3c0ac270069eb8fdefaafaa /st-urlhandler | |
Diffstat (limited to 'st-urlhandler')
| -rwxr-xr-x | st-urlhandler | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/st-urlhandler b/st-urlhandler new file mode 100755 index 0000000..0d39dd5 --- /dev/null +++ b/st-urlhandler @@ -0,0 +1,15 @@ +#!/bin/sh + +urlregex="(((http|https)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)" + +# First remove linebreaks and mutt sidebars: +urls="$(sed 's/.*│//g' | tr -d '\n' | + grep -aEo "$urlregex" | # grep only urls as defined above. + uniq | # Ignore neighboring duplicates. + sed 's/^www./http:\/\/www\./g')" + +[ -z "$urls" ] && exit + +chosen="$(echo "$urls" | dmenu -i -p 'Follow which url?' -l 10)" + +setsid xdg-open "$chosen" >/dev/null 2>&1 & |
