diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2026-02-27 13:41:56 +0200 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2026-02-27 13:41:56 +0200 |
| commit | da28548905dab7c60c3fcec4975ccfa23e315909 (patch) | |
| tree | 9cef34a718563969a6bcda5cfeff033eeaf6b1a0 /example/opener_mime | |
0.99.0
Diffstat (limited to 'example/opener_mime')
| -rwxr-xr-x | example/opener_mime | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/example/opener_mime b/example/opener_mime new file mode 100755 index 0000000..2f7bd52 --- /dev/null +++ b/example/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 + |