mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-25 08:25:47 +01:00
3f44e88d6e
has no alpha patch
15 lines
484 B
Bash
Executable file
15 lines
484 B
Bash
Executable file
#!/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 &
|