diff options
author | Yaroslav <contact@yaroslavps.com> | 2020-04-04 22:15:21 +0300 |
---|---|---|
committer | Yaroslav <contact@yaroslavps.com> | 2020-04-04 22:15:21 +0300 |
commit | 69204c648abbd4463b6a1e3b6cbb67a394842379 (patch) | |
tree | 45a5a1ca7d7423a3f7aeff1241365faaf472e757 /dotfiles/.local/bin/linkhandler | |
parent | b7fd6ea69b9d207592b92b8fa5c8d0b33b271361 (diff) | |
download | swayrice-69204c648abbd4463b6a1e3b6cbb67a394842379.tar.gz swayrice-69204c648abbd4463b6a1e3b6cbb67a394842379.zip |
new menu script for opening different links with different programs (or performing a search)
Diffstat (limited to 'dotfiles/.local/bin/linkhandler')
-rwxr-xr-x | dotfiles/.local/bin/linkhandler | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dotfiles/.local/bin/linkhandler b/dotfiles/.local/bin/linkhandler index c616d04..338750d 100755 --- a/dotfiles/.local/bin/linkhandler +++ b/dotfiles/.local/bin/linkhandler @@ -6,7 +6,7 @@ # if a music file or pdf, it will download, # otherwise it opens link in browser. -# If no url given. Opens browser. For using script as $BROWSER. +# If no url given opens browser. [ -z "$1" ] && { "$BROWSER"; exit; } case "$1" in @@ -16,7 +16,8 @@ case "$1" in curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; - *) - if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1" - else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;; + *://*|*.*) + setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; + *) # If it's not a url, perform a search using duckduckgo + setsid "$BROWSER" "https://duckduckgo.com/?q=$1&t=ffab&atb=v1-1" >/dev/null 2>&1 & ;; esac |