Skip to content

Commit bfea9e5

Browse files
Coko7junegunn
andauthored
fzf-preview.sh: Use kitten icat on ghostty (#4232)
Co-authored-by: Junegunn Choi <[email protected]>
1 parent a242002 commit bfea9e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bin/fzf-preview.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ elif ! [[ $KITTY_WINDOW_ID ]] && (( FZF_PREVIEW_TOP + FZF_PREVIEW_LINES == $(stt
5757
dim=${FZF_PREVIEW_COLUMNS}x$((FZF_PREVIEW_LINES - 1))
5858
fi
5959

60-
# 1. Use kitty icat on kitty terminal
61-
if [[ $KITTY_WINDOW_ID ]]; then
60+
# 1. Use icat (from Kitty) if kitten is installed
61+
if [[ $KITTY_WINDOW_ID ]] || [[ $GHOSTTY_RESOURCES_DIR ]] && command -v kitten > /dev/null; then
6262
# 1. 'memory' is the fastest option but if you want the image to be scrollable,
6363
# you have to use 'stream'.
6464
#
6565
# 2. The last line of the output is the ANSI reset code without newline.
6666
# This confuses fzf and makes it render scroll offset indicator.
6767
# So we remove the last line and append the reset code to its previous line.
68-
kitty icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/'
68+
kitten icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/'
6969

7070
# 2. Use chafa with Sixel output
7171
elif command -v chafa > /dev/null; then

0 commit comments

Comments
 (0)