From d05902f42ce02691de3fe0aefa9db4e331e7c7d4 Mon Sep 17 00:00:00 2001 From: Olli Date: Sat, 5 Sep 2026 12:36:48 +0200 Subject: [PATCH] Add lf file preview script --- preview.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 preview.sh diff --git a/preview.sh b/preview.sh new file mode 100755 index 0000000..a03e916 --- /dev/null +++ b/preview.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +case "$(file -Lb --mime-type -- "$1")" in + image/*) + chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg black "$1" + ;; + video/*) + ffmpegthumbnailer -i "$1" -s 0 -c jpg -o - | chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg black - + ;; + application/pdf) + magick -density 150 "$1[0]" -trim -flatten -sharpen 0x1.0 png:- | chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg white - + ;; + application/json) + cat "$1" | jq '.' + ;; + text/*) + bat "$1" + ;; +esac