From 67a1c24a8661fdcbc48f72f7b65521772065d305 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 28 Feb 2026 21:52:26 +0200 Subject: dfm: add ranger style bulk rename Also the ability to embed scripts within dfm. --- script/opener_mime | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 script/opener_mime (limited to 'script/opener_mime') diff --git a/script/opener_mime b/script/opener_mime new file mode 100755 index 0000000..2f7bd52 --- /dev/null +++ b/script/opener_mime @@ -0,0 +1,33 @@ +#!/bin/sh -feu +# +# Example DFM_OPENER script using mimetype. +# + +mime_type=$(file -bi "$1") + +case $mime_type in + audio/*) + exec mpv --no-video "$1" + ;; + + video/*) + exec mpv "$1" + ;; + + image/*) + exec gimp "$1" + ;; + + text/html* | application/pdf*) + exec firefox "$1" + ;; + + text/*) + exec "${EDITOR:=vi}" "$1" + ;; + + *?*) + printf 'error: unhandled mime-type %s\n' "$mime_type" >&2 + ;; +esac + -- cgit v1.2.3