summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCoko <91132775+Coko7@users.noreply.github.com>2025-02-09 12:02:05 +0100
committerGitHub <noreply@github.com>2025-02-09 20:02:05 +0900
commitbfea9e53a62777a433af25552d440537297a1323 (patch)
tree89b24feb76cb6aabd621e92824654f1e11807766 /bin
parenta2420026ab434fc413f62ab46e0060e7c515a0d7 (diff)
downloadfzf-bfea9e53a62777a433af25552d440537297a1323.tar.gz
fzf-preview.sh: Use kitten icat on ghostty (#4232)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fzf-preview.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/fzf-preview.sh b/bin/fzf-preview.sh
index e74e46e2..ebf5b0d8 100755
--- a/bin/fzf-preview.sh
+++ b/bin/fzf-preview.sh
@@ -57,15 +57,15 @@ elif ! [[ $KITTY_WINDOW_ID ]] && (( FZF_PREVIEW_TOP + FZF_PREVIEW_LINES == $(stt
dim=${FZF_PREVIEW_COLUMNS}x$((FZF_PREVIEW_LINES - 1))
fi
-# 1. Use kitty icat on kitty terminal
-if [[ $KITTY_WINDOW_ID ]]; then
+# 1. Use icat (from Kitty) if kitten is installed
+if [[ $KITTY_WINDOW_ID ]] || [[ $GHOSTTY_RESOURCES_DIR ]] && command -v kitten > /dev/null; then
# 1. 'memory' is the fastest option but if you want the image to be scrollable,
# you have to use 'stream'.
#
# 2. The last line of the output is the ANSI reset code without newline.
# This confuses fzf and makes it render scroll offset indicator.
# So we remove the last line and append the reset code to its previous line.
- kitty icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/'
+ kitten icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/'
# 2. Use chafa with Sixel output
elif command -v chafa > /dev/null; then