Krolyxon
Commit 88bcaeb

Branches

Refs →

dotfiles-x1188bcaeb

add support for avif in lf

Author
krolyxon
Date
2023-02-13 20:48 +0530
Parent
f8faf9d
Commit
88bcaeb8b87ec78953c0633a5519dfd2e50af8aa

+4 −1

2 files changed

  1. M .config/lf/lfrc +1 −1
  2. M .config/lf/scope +3 −0
M .config/lf/lfrc View
@@ -18,7 +18,7 @@ cmd open ${{
1818 text/*|application/json|inode/x-empty) $EDITOR $fx;;
1919 image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
2020 image/svg+xml) display -- $f ;;
21− image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
21+ image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" |
2222 setsid -f nsxiv -aio 2>/dev/null | while read -r file; do
2323 [ -z "$file" ] && continue
2424 lf -remote "send select \"$file\""
M .config/lf/scope View
@@ -22,6 +22,9 @@ ifub() {
2222 # be regenerated once seen.
2323
2424 case "$(file --dereference --brief --mime-type -- "$1")" in
25+ image/avif) 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)"
26+ [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg"
27+ image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
2528 image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;;
2629 text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
2730 text/troff) man ./ "$1" | col -b ;;