2020-04-15 22:43:14 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-08-07 10:44:29 +02:00
|
|
|
urlregex="(((http|https)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)"
|
2020-04-15 22:43:14 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2020-04-16 20:48:52 +02:00
|
|
|
chosen="$(echo "$urls" | dmenu -i -p 'Follow which url?' -l 10)"
|
2020-04-15 22:43:14 +02:00
|
|
|
|
|
|
|
setsid xdg-open "$chosen" >/dev/null 2>&1 &
|