dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 09b3c1c6009ed6766a02b46d995baa515c3d1d44
parent 62fd4b81bfda095038bd532ebc23884bb018d02c
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Sat,  1 May 2021 14:13:36 +0200

opener: call linkhandler for links

Diffstat:
Mscripts/linkhandler | 2+-
Mscripts/opener | 36++++++++++++++++++++----------------
2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/scripts/linkhandler b/scripts/linkhandler @@ -44,7 +44,7 @@ case "$1" in esac ;; *) - if [ -f "$1" ]; then "$EDITOR" "$1" + if [ -f "$1" ]; then "${EDITOR:-vim}" "$1" else open "$1" >/dev/null 2>&1 fi ;; diff --git a/scripts/opener b/scripts/opener @@ -1,19 +1,23 @@ #!/bin/sh [ $# -gt 0 ] || { printf "File required in argument.\n" && exit 1; } -case $(file --mime-type "$1" -bL) in - text/*|application/json|inode/x-empty) { [ -n "$VIM_TERMINAL" ] && vimsend "$1"; } || ${EDITOR:-vim} "$1";; - image/*) setsid -f sxiv "$@" 2>&1;; - application/epub*) setsid -f ebook-viewer "$1" >/dev/null 2>&1;; - application/pdf*) setsid -f zathura "$1" >/dev/null 2>&1;; - application/x-sc|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) sc-im "$1";; - video/*) mpvq "$@";; - audio/*) mpv --no-audio-display --no-video --volume=50 "$1";; - application/x-mach-binary) ;; - application/octet-stream) - case "$1" in - *.mp3) mpv --no-audio-display --no-video --volume=50 "$1";; - *.dmg) setsid -f open "$@" > /dev/null 2>&1;; - esac - ;; - *) setsid -f open "$@" > /dev/null 2>&1;; +case "$1" in + http*) linkhandler "$@";; + *) + case $(file --mime-type "$1" -bL) in + text/*|application/json|inode/x-empty) { [ -n "$VIM_TERMINAL" ] && vimsend "$1"; } || ${EDITOR:-vim} "$1";; + image/*) setsid -f sxiv "$@" 2>&1;; + application/epub*) setsid -f ebook-viewer "$1" >/dev/null 2>&1;; + application/pdf*) setsid -f zathura "$1" >/dev/null 2>&1;; + application/x-sc|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) sc-im "$1";; + video/*) mpvq "$@";; + audio/*) mpv --no-audio-display --no-video --volume=50 "$1";; + application/x-mach-binary) ;; + application/octet-stream) + case "$1" in + *.mp3) mpv --no-audio-display --no-video --volume=50 "$1";; + *.dmg) setsid -f open "$@" > /dev/null 2>&1;; + esac + ;; + *) setsid -f open "$@" > /dev/null 2>&1;; + esac;; esac