diff options
author | Luke Smith <luke@lukesmith.xyz> | 2020-04-15 16:43:14 -0400 |
---|---|---|
committer | Luke Smith <luke@lukesmith.xyz> | 2020-04-15 16:43:14 -0400 |
commit | baa9fa076a4e334e04532b218a925b0a8e367a8c (patch) | |
tree | 77866beec5e86fa84af30921dd0a6b2f0b36a9d8 /st-urlhandler | |
parent | d9f3fd8a16705e5adcb491234a076f6b94dfe4f5 (diff) |
following links now separate script
this avoids the effects of swallow in dwm
it also will not produce dmenu without found urls
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..a68c46c --- /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 -w "$(xdotool getactivewindow)" -i -p 'Follow which url?' -l 10)" + +setsid xdg-open "$chosen" >/dev/null 2>&1 & |