aboutsummaryrefslogtreecommitdiff
path: root/.config/lf/scope
blob: 5f892ed0c9f663005494d05d83490cc3db8fbe50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
case "$(file -Lb --mime-type -- "$1")" in
  image/*)
    chafa -f sixel -s "$2x$3" --animate off --polite on "$1"
    exit 1
    ;;
  text/*)
    cat "$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