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

[Feature Request] - Implement kittys terminal graphics protocol #2814

Open
misaelaguayo opened this issue Sep 25, 2023 · 11 comments
Open

[Feature Request] - Implement kittys terminal graphics protocol #2814

misaelaguayo opened this issue Sep 25, 2023 · 11 comments

Comments

@misaelaguayo
Copy link

It would be neat if zellij could use kitty terminal graphics to display images or other files. Tmux had a similar issue closed, it seems like they will not be implementing it. Zellij does provide support for sixels but this is a very old protocol with not much support from other applications.

@tcoopman
Copy link

FIY: On the yazi wiki, there's a fix to use it with tmux: https://github.com/sxyazi/yazi/wiki/Image-preview-within-tmux
This looks like a workaround, not sure how it works exactly but maybe zellij can do something similar?

@daveman1010221
Copy link

Is there a sense of the work required to implement this?

@Dich0tomy
Copy link

FIY: On the yazi wiki, there's a fix to use it with tmux: https://github.com/sxyazi/yazi/wiki/Image-preview-within-tmux This looks like a workaround, not sure how it works exactly but maybe zellij can do something similar?

Yes, but it's extremely slow on tmux for some reason.

@Dich0tomy
Copy link

Is there a sense of the work required to implement this?

There's a plethora of users that want to enjoy images in their terminal and some terminal tools implement image support (image.nvim plugin for neovim, neorg plugin for neovim, a lot of file browsers, etc.). I almost never leave terminal and currently use tmux, image implementation in zellij would be a dealbreaker for me.

@sxyazi
Copy link

sxyazi commented Nov 14, 2023

I really want to see Zellij support kitty graphics protocol, which is currently the most complete and advanced.

It supports Unicode placeholders, I think this could solve the stuttering issue in Zellij's Sixel implementation. Kitty protocol simply prints some escape sequence to the screen, and terminals that support that protocol display it as an image and accurately render the image position when scrolling.

This process is transparent to Zellij, and it doesn't need to parse and understand the meaning of the protocol itself, making it efficient.

I've just implemented Unicode placeholders for Yazi and tested it in kitty+tmux, it works well:

kitty+tmux.mp4

@musjj
Copy link

musjj commented Jan 15, 2024

@sxyazi
Is there something that needs to be done on zellij's side for this to work? I'm testing yazi (with the latest commit) from inside zellij, but image previews still doesn't work.

I've also tested it under tmux and it kinda works, but everything is really buggy (overlapping images, preview not updating, etc.) for some reason.

@sxyazi
Copy link

sxyazi commented Jan 16, 2024

Is there something that needs to be done on zellij's side for this to work? I'm testing yazi (with the latest commit) from inside zellij, but image previews still doesn't work.

Yes, Zellij does not support it; this requires Zellij to provide support.

I've also tested it under tmux and it kinda works, but everything is really buggy (overlapping images, preview not updating, etc.) for some reason.

What are your Yazi version and tmux version? What terminal are you using? Please also do an echo $TERM, $TERM_PROGRAM, $XDG_SESSION_TYPE and paste the output here.

@AnonymouX47
Copy link

Just came across this and thought I should chime in.

I believe what's required on zellij's end is a Passthrough sequence (I don't know if such exists yet but I suspect not) i.e some something like this. No special handling of graphics control sequences should be required.

This should be all that's required to get Kitty's virtual placements working, assuming Zellij already supports indexed- (and optionally, direct-) -color SGR sequences and passes them through as recieved.

It'll also allow the use of other image/graphics protocols to a certain extent, particularly in full-screen (non-scrolling) applications. For full/proper support, specialized implementations/handling will be required but personally, I'd discourage that for a terminal multiplexer.

@sweetbbak
Copy link

sweetbbak commented Feb 25, 2024

This is also how this issue was solved with junegunn/fzf junegunn/fzf kitty image protocol passthrough fix

He uses a regex to detect the terminal sequence for images then assigns a no-op function for the preview that allows the un-altered terminal sequence to passthrough to the terminal so that the image is rendered like normal.

You can test this with:

fd . ~/Pictures -e png | fzf --preview='kitty icat --clear --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {}'

@hfytr
Copy link

hfytr commented Jun 17, 2024

is this still being worked on?

@misaelaguayo
Copy link
Author

I don’t think anyone has started to implement this. Just been talking about ways in which it could be achieved

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

No branches or pull requests

9 participants