diff options
| author | twells46 <173561638+twells46@users.noreply.github.com> | 2025-12-31 13:28:05 -0600 |
|---|---|---|
| committer | twells46 <173561638+twells46@users.noreply.github.com> | 2025-12-31 13:28:05 -0600 |
| commit | 2140ab51deed88e90eafebf9520fa5f9995dc7c9 (patch) | |
| tree | 03cf1dcd2900495c1efb79aaa85f3254ecd5fb87 /dot_config/lf/executable_previewer | |
| parent | ff8f50638e4b17a9d7cc88d2f0d9560b7effce39 (diff) | |
Migrate from stow
Diffstat (limited to 'dot_config/lf/executable_previewer')
| -rw-r--r-- | dot_config/lf/executable_previewer | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/dot_config/lf/executable_previewer b/dot_config/lf/executable_previewer new file mode 100644 index 0000000..b8cad0c --- /dev/null +++ b/dot_config/lf/executable_previewer @@ -0,0 +1,35 @@ +#!/bin/sh +draw() { + kitten icat --stdin no --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$1" </dev/null >/dev/tty + exit 1 +} + +file="$1" +w="$2" +h="$3" +x="$4" +y="$5" + +out="$(pistol $file)" +offset="$(echo $out | wc -l)" +y="$((y+offset))" + +echo "$out" + +case "$(file -Lb --mime-type "$file")" in + image/*) + draw "$file" + ;; + video/*) + # vidthumb is from here: + # https://raw.githubusercontent.com/duganchen/kitty-pistol-previewer/main/vidthumb + draw "$(vidthumb "$file" ffmpegthumbnailer)" + ;; + audio/*) + draw "$(vidthumb "$file" ffmpegthumbnailer)" + ;; + application/pdf) + draw "$(vidthumb "$file" magick)" + ;; +esac + |