Krolyxon
Commit 334eaef

Branches

Refs →

aurora.configlfscope

14 lines · 473 B · Bourne Again Shell (bash)

1#!/bin/sh
2case "$(file -Lb --mime-type -- "$1")" in
3 image/*)
4 chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg black "$1"
5 ;;
6 video/*)
7 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)"
8 ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0
9 chafa -f sixel -s "$2x$3" --animate off --polite on -t 1 --bg black "$CACHE"
10 ;;
11 text/*)
12 bat "$1"
13 ;;
14esac