summaryrefslogtreecommitdiffstats
path: root/.config/lf/scope
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2024-05-23 13:03:55 -0400
committerLuke Smith <luke@lukesmith.xyz>2024-05-23 13:03:55 -0400
commit28eff887e0eb3149e7f982534a3a9e1b69451758 (patch)
tree1064db05bf1d610159a56d55fcdb547df801e756 /.config/lf/scope
parent441d26b75d535bf9291b7f994f46f30e35e0c090 (diff)
parentdb6ee8f8197dec0d0e3333f9c912bef38387a3e7 (diff)
downloadeibhear-28eff887e0eb3149e7f982534a3a9e1b69451758.tar.gz
eibhear-28eff887e0eb3149e7f982534a3a9e1b69451758.tar.zst
eibhear-28eff887e0eb3149e7f982534a3a9e1b69451758.zip
Merge branch 'master' of github.com:LukeSmithxyz/voidrice
Diffstat (limited to '.config/lf/scope')
-rwxr-xr-x.config/lf/scope11
1 files changed, 6 insertions, 5 deletions
diff --git a/.config/lf/scope b/.config/lf/scope
index cc55669..8265a87 100755
--- a/.config/lf/scope
+++ b/.config/lf/scope
@@ -13,10 +13,6 @@ image() {
fi
}
-ifub() {
- [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1
-}
-
# Note that the cache file name is a function of file information, meaning if
# an image appears in multiple places across the machine, it will not have to
# be regenerated once seen.
@@ -29,10 +25,15 @@ case "$(file --dereference --brief --mime-type -- "$1")" in
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" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
+image/svg+xml)
+ 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" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1"
+ image "$CACHE.png" "$2" "$3" "$4" "$5" "$1"
+ ;;
image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;;
text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
text/troff) man ./ "$1" | col -b ;;
- text/* | */xml | application/json | application/x-ndjson) bat --terminal-width "$(($4-2))" -f "$1" ;;
+ text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;;
audio/* | application/octet-stream) mediainfo "$1" || exit 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)"