commit ccc967e86c538d7f48e47f8e0ecf2b54b5e3b4ad parent c58d685b158efc3a410bd30f81b58c9192f89854 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Mon, 9 Sep 2019 09:53:02 +0200 Do not ask for action for certain urls Diffstat:
M | .local/bin/linkhandler | | | 16 | ++++++++++++++-- |
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler @@ -7,8 +7,18 @@ for url in "$@"; do setsid "$TERMINAL" -e "$EDITOR $url" exit 0; fi - action="$(printf "open\nopen (tbb)\nxclip\nbookmark\ncurl\nhtml to pdf\nsci-hub\nadd bibref\nmpv\nyoutube-dl\nyoutube-dl-music" | \ - dmenu_themed -i -p "action:")" + + action="undefined" + case "$url" in + *youtube.com*|*youtu.be*) + action="youtube-dl" ;; + *smbc-comics.com*|*xkcd.com*|*jspowerhour.com*) + action="comic" ;; + *) + action="$(printf "open\nopen (tbb)\nxclip\nbookmark\ncurl\nhtml to pdf\nsci-hub\nadd bibref\nmpv\nyoutube-dl\nyoutube-dl-music" | \ + dmenu_themed -i -p "action:")";; + esac + case "$action" in "open") setsid xdg-open "$url" >/dev/null 2>&1 & ;; @@ -20,6 +30,8 @@ for url in "$@"; do description="$(echo "$(date), $hostname" | \ dmenu_themed -p "description:")" setsid $TERMINAL bookmark "$url" "$description" & ;; + "comic") + setsid tsp comic "$url" >/dev/null 2>&1 & ;; "curl") setsid tsp curl -LO "$url" >/dev/null 2>&1 & ;; "html to pdf")