Add image and vid previews in lf

This commit is contained in:
2024-04-20 11:49:43 +02:00
parent 0f5c47bcf9
commit 2942243cde
4 changed files with 32 additions and 0 deletions

21
.config/lf/lf_kitty_preview Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
file=$1
w=$2
h=$3
x=$4
y=$5
filetype="$( file -Lb --mime-type "$file")"
if [[ "$filetype" =~ ^image ]]; then
kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" < /dev/null > /dev/tty
exit 1
fi
if [[ "$filetype" =~ ^video ]]; then
kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$(vidthumb "$file")" < /dev/null > /dev/tty
exit 1
fi
pistol "$file"