1
0
Fork 0

lf: clean up preview

This commit is contained in:
Luca Bilke 2024-10-23 17:12:22 +02:00
parent faf4613719
commit 6e2e0d6d89
Signed by: luca
GPG Key ID: F6E11C9BAA7C82F5
1 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ RED="\033[31m"
RESET="\033[0m" RESET="\033[0m"
RS="$(printf "\037")" RS="$(printf "\037")"
CACHE="${XDG_CACHE_HOME}/lf/$(stat --printf "%n\0%i\0%F\0%s\0%W\0%Y" -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')" CACHE="${XDG_CACHE_HOME}/lf/$(stat --printf "%n\0%i\0%F\0%s\0%W\0%Y" -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
BAT="bat --style=plain --color=always --italic-text=always --pager=never --tabs=4 --theme=base16 --line-range=":$h" --terminal-width="$((w - 2))"" BAT="bat --style=plain --color=always --italic-text=always --pager=never --tabs=4 --theme=base16 --line-range=:$h --terminal-width=$((w - 2))"
CHAFA="chafa -f sixel -s ${w}x${h} --polite on --animate false" CHAFA="chafa -f sixel -s ${w}x${h} --polite on --animate false"
run() { run() {
@ -28,10 +28,10 @@ run() {
cached_text() { cached_text() {
if [ -f "$CACHE" ]; then if [ -f "$CACHE" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
$BAT $BAT_ARGS "$CACHE" $BAT "$CACHE"
else else
# shellcheck disable=SC2086 # shellcheck disable=SC2086
run "$@" | tee -p "$CACHE" | $BAT $BAT_ARGS run "$@" | tee -p "$CACHE" | $BAT
fi fi
} }