commit 8a547a3fe947e7d5734913dddb78cc8f95d81754 parent 50281cfb09830bc40f6307de95854a30e3f034bd Author: Alex Balgavy <a.balgavy@gmail.com> Date: Tue, 29 Sep 2020 13:13:45 +0200 linkhandler: different actions for different links Queues videos on mpv, opens images remotely using sxiv, etc. Former-commit-id: 3599490ec77ef6f7473706f41b4ce2fa12cb7ffa Diffstat:
A | scripts/linkhandler | | | 24 | ++++++++++++++++++++++++ |
1 file changed, 24 insertions(+), 0 deletions(-)
diff --git a/scripts/linkhandler b/scripts/linkhandler @@ -0,0 +1,24 @@ +#!/bin/sh +[ -z "$1" ] && { "$BROWSER"; exit; } + +case "$1" in + *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*) + setsid -f mpvq "$1" 1>/dev/null 2>&1 + ;; + *png|*jpg|*jpe|*jpeg|*gif) + curl -sL "$1" > "/tmp/$(printf "%s" "$1" | sed "s/.*\///")" \ + && sxiv -a "/tmp/$(printf "%s" "$1" | sed "s/.*\///")" 1>/dev/null 2>&1 & + ;; + *mp3|*flac|*opus|*mp3?source*) + setsid -f mpva "$1" + ;; + http://*|https://*) + w3m "$1" + ;; + *) + if [ -f "$1" ]; then "$EDITOR" "$1" + else open "$1" >/dev/null 2>&1 + fi + ;; +esac +