Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bin/fzf-preview.sh to make image preview work on ghostty terminal #4232

Merged
merged 3 commits into from
Feb 9, 2025

Conversation

Coko7
Copy link
Contributor

@Coko7 Coko7 commented Feb 9, 2025

Fix bin/fzf-preview.sh so that image preview works on ghostty terminal.

Issue

Despite ghostty supporting the Kitten graphics protocol, the image preview does not work even if kitten is installed on the system because the script only checks for the KITTY_WINDOW_ID environment variable, which is unset in ghostty terminal sessions.
So, when trying to preview images in ghostty, it merely prints the file type:

coko7@example:~$ ./fzf-preview.sh arch_rainbow.png
arch_rainbow.png: PNG image data, 3840 x 2160, 8-bit/color RGBA, non-interlaced

Solution

Check if kitten is installed on the system using command -v kitten.
See: https://sw.kovidgoyal.net/kitty/kittens_intro/

@junegunn
Copy link
Owner

junegunn commented Feb 9, 2025

Could you provide more details?

@Coko7
Copy link
Contributor Author

Coko7 commented Feb 9, 2025

Hi, sorry for the lack of details. I have edited to include more. I hope it's better

@Coko7 Coko7 changed the title Fix bin/fzf-preview.sh to work with ghostty terminal Fix bin/fzf-preview.sh to make image preview work on ghostty terminal Feb 9, 2025
bin/fzf-preview.sh Outdated Show resolved Hide resolved
… icat rather than kitty icat (works with ghostty)
bin/fzf-preview.sh Outdated Show resolved Hide resolved
@junegunn junegunn merged commit bfea9e5 into junegunn:master Feb 9, 2025
5 checks passed
@junegunn
Copy link
Owner

junegunn commented Feb 9, 2025

Merged, thanks!

@Coko7
Copy link
Contributor Author

Coko7 commented Feb 9, 2025

You are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants