From ac8b19f7c8bd1a4ec2a34a59268ce31285916d27 Mon Sep 17 00:00:00 2001 From: awy Date: Tue, 13 Aug 2024 11:46:15 +0300 Subject: fixes --- .config/lf/scope | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to '.config/lf/scope') diff --git a/.config/lf/scope b/.config/lf/scope index a7d0bc1..5f892ed 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -1,29 +1,14 @@ #!/bin/sh -draw() { - kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$1" /dev/tty - exit 1 -} - -file="$1" -w="$2" -h="$3" -x="$4" -y="$5" - -case "$(file -Lb --mime-type "$file")" in +case "$(file -Lb --mime-type -- "$1")" in image/*) - draw "$file" + chafa -f sixel -s "$2x$3" --animate off --polite on "$1" + exit 1 + ;; + text/*) + cat "$1" ;; - audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/*) - # vidthumb is from here: - # https://raw.githubusercontent.com/duganchen/kitty-pistol-previewer/main/vidthumb 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 - draw "$CACHE" - #draw "$(vidthumb "$file")" - ;; - text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; + chafa -f sixel -s "$2x$3" --animate off --polite on "$CACHE" esac - -#pistol "$file"lace "${2}x${3}@${4}x${5}" "$1" -- cgit v1.2.3