From 69204c648abbd4463b6a1e3b6cbb67a394842379 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Sat, 4 Apr 2020 22:15:21 +0300 Subject: new menu script for opening different links with different programs (or performing a search) --- dotfiles/.local/bin/linkhandler | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'dotfiles/.local/bin/linkhandler') 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 -- cgit v1.2.3