dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit d283eb8307374fef02ebee69cbc3ccc55e761735
parent ccc967e86c538d7f48e47f8e0ecf2b54b5e3b4ad
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon,  9 Sep 2019 09:58:25 +0200

Open images and pdfs directly

Diffstat:
M.local/bin/linkhandler | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler @@ -10,6 +10,8 @@ for url in "$@"; do action="undefined" case "$url" in + *.png|*.PNG|*.jpg|*.JPG|*.jpeg|*.JPEG|*.tif|*.TIF|*.bmp|*.BMP|*.pdf|*.PDF) + action="xdg-open" ;; *youtube.com*|*youtu.be*) action="youtube-dl" ;; *smbc-comics.com*|*xkcd.com*|*jspowerhour.com*) @@ -31,7 +33,7 @@ for url in "$@"; do dmenu_themed -p "description:")" setsid $TERMINAL bookmark "$url" "$description" & ;; "comic") - setsid tsp comic "$url" >/dev/null 2>&1 & ;; + setsid comic "$url" >/dev/null 2>&1 & ;; "curl") setsid tsp curl -LO "$url" >/dev/null 2>&1 & ;; "html to pdf") @@ -45,6 +47,9 @@ for url in "$@"; do getdoi "$url" | getref --notify >> "$BIB" & ;; "mpv") setsid mpv -quiet "$url" >/dev/null 2>&1 & ;; + "xdg-open") + f="$(curl -s --write-out "%{filename_effective}\n" -OL "$url")" + xdg-open "$f" ;; "youtube-dl") setsid tsp youtube-dl "$url" >/dev/null 2>&1 & ;; "youtube-dl-music")