dotfiles-x1188bcaeb
add support for avif in lf
+4 −1
2 files changed
- M .config/lf/lfrc +1 −1
- M .config/lf/scope +3 −0
| @@ -18,7 +18,7 @@ cmd open ${{ | |||
| 18 | 18 | text/*|application/json|inode/x-empty) $EDITOR $fx;; | |
| 19 | 19 | image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; | |
| 20 | 20 | 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\)*$" | | |
| 22 | 22 | setsid -f nsxiv -aio 2>/dev/null | while read -r file; do | |
| 23 | 23 | [ -z "$file" ] && continue | |
| 24 | 24 | lf -remote "send select \"$file\"" | |
| @@ -22,6 +22,9 @@ ifub() { | |||
| 22 | 22 | # be regenerated once seen. | |
| 23 | 23 | ||
| 24 | 24 | 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" ;; | |
| 25 | 28 | image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; | |
| 26 | 29 | text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; | |
| 27 | 30 | text/troff) man ./ "$1" | col -b ;; | |