diff options
author | awy <awy@awy.one> | 2024-11-24 13:29:56 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2024-11-24 13:29:56 +0300 |
commit | 511afc41829d5626e9e9b84cbc3d4a7c14d63165 (patch) | |
tree | 14e7cb05f7206e39828bc49e6689f530615a41b9 /.config/lf/scope | |
parent | 7b52375768323ce6b88156aa48b0d50ec2c8dafc (diff) |
upload
Diffstat (limited to '.config/lf/scope')
-rwxr-xr-x | .config/lf/scope | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/.config/lf/scope b/.config/lf/scope new file mode 100755 index 0000000..b79c4b6 --- /dev/null +++ b/.config/lf/scope @@ -0,0 +1,13 @@ +#!/bin/sh +case "$(file -Lb --mime-type -- "$1")" in + image/*) + chafa -f sixel -s "$2x$3" --animate off --polite on "$1" + exit 1 + ;; + text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + chafa -f sixel -s "$2x$3" --animate off --polite on "$CACHE" +esac |