st-url fix.
This commit is contained in:
parent
7c1baf8809
commit
f699089c50
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)"
|
||||
urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9.,/@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)"
|
||||
|
||||
urls="$(sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sidebars:
|
||||
grep -aEo "$urlregex" | # grep only urls as defined above.
|
||||
@ -12,8 +12,8 @@ urls="$(sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sideb
|
||||
|
||||
while getopts "hoc" o; do case "${o}" in
|
||||
h) printf "Optional arguments for custom use:\\n -c: copy\\n -o: xdg-open\\n -h: Show this message\\n" && exit 1 ;;
|
||||
o) chosen="$(echo "$urls" | dmenu -l 20 -i -p 'open')"
|
||||
o) chosen="$(echo "$urls" | dmenu -c -l 20 -i)"
|
||||
setsid xdg-open "$chosen" >/dev/null 2>&1 & ;;
|
||||
c) echo "$urls" | dmenu -i -p 'copy' -l 10 | tr -d '\n' | xsel -l /dev/null ;;
|
||||
c) echo "$urls" | dmenu -c -l 20 -i| tr -d '\n' | xsel -l /dev/null ;;
|
||||
*) printf "Invalid option: -%s\\n" "$OPTARG" && exit 1 ;;
|
||||
esac done
|
||||
|
Loading…
Reference in New Issue
Block a user