You are not logged in.

#1 2023-06-10 14:53:57

meezoarch
Member
Registered: 2022-12-01
Posts: 42

Using build-in Kitty image previews on LF file manager.

I migrated to Kitty terminal. I use LF file manager with Uberzug with a preview/scope script and a cleaner script.
I now want to use the build-in image previews of Kitty.
I am able to view the images but not able to clear them. They are previewed and keep stacking overeach other and never disappear.
Here are parts of my preview script:

image() {
	if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
	file=$1
	w=$2
	h=$3
	x=$4
	y=$5
	kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" < /dev/null > /dev/tty
		exit 1
	else
		chafa "$1" -s "$4x"
	fi
}


CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"

case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in


		;;
	*.pdf)
		[ ! -f "${CACHE}.jpg" ] && \
			pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
		image "${CACHE}.jpg" "$2" "$3" "$4" "$5"

		;;
	*.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx)
		[ ! -f "${CACHE}.jpg" ] && \
			ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5
		image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
		;;
	*.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.tiff|*.gif|*.jfif|*.ico)
		image "$1" "$2" "$3" "$4" "$5"
		;;

And my cleaner script is:

#The below is for kitty but needs fixing.
	kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty

Any idea how to fix this?

Offline

#2 2025-06-02 18:37:39

Undercover
Member
Registered: 2024-02-06
Posts: 1

Re: Using build-in Kitty image previews on LF file manager.

Here's  the command I'm using:

kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" < /dev/null > /dev/tty

Works fine,  just not over SSH. Trying to figure that one out.

Offline

Board footer

Powered by FluxBB