Skip to content

Conversation

@meck
Copy link

@meck meck commented Nov 1, 2025

Thanks for a nice app, i work a lot in tmux so i took a stab at enabling serie in kitty
using the "Unicode placeholder" method.

Seems to work fine in kitty, ghostty seems to have some issues with placement. I don't know if
iterm has something equivalent to enable it there as well.

I just wanted se if you are interested in merging and some initial feedback in that case, currently the image tests are failing as the image sizes are now dependent cell size and differs depending on what font is used...

@lusingander
Copy link
Owner

Thank you for your pull request.

I believe that utilizing the unicode placeholder functionality would be beneficial.
While it is possible to pass escape sequences through the iterm's protocol as well, it did not work as expected on my end at least, which is why I hadn't implemented it.
Given that there is significant demand for tmux support, it might be a good idea to support at least kitty's protocol.

I have not yet been able to thoroughly examine the implementation details (or rather, kitty's unicode placeholder functionality), so I will need to check it later.
But basically, it seems like a good idea to do it.

meck added 5 commits November 6, 2025 12:22
The kitty unicode placeholder protocol does not change
the aspect ratio when presenting images, this can
lead to gaps between images
Autodetection does not match pregenerated images
This is much more reliable then checking for envars,
especially if connected via SSH or tmux as the envars
might be missing, and should work automatically with
new terminals supporting the kitty protocol
@meck meck marked this pull request as ready for review November 7, 2025 11:34
@meck
Copy link
Author

meck commented Nov 7, 2025

@lusingander I would consider this quite ready and cleaner now, The scope got a bit bigger.

I've rewrote the cell size code to have minimal size when drawing the image and calculate dimensions to match the previous behavior for a 1:2 image.

I discovered that the envars for detecting terminal type might not be present on tmux and ssh session, so i changed the detection algo to query the underlying terminal directly if the kitty protocol is enabled using terminal escape codes.

Ghostty detection now also works as expected, and any future terminals that support the protocol should work without modifications

@lusingander
Copy link
Owner

Thank you, I'm not sure if I can check it immediately, but I will.

@lusingander
Copy link
Owner

I haven't investigated it thoroughly, but it seems unstable regardless of tmux usage.
When I opened several repositories in Ghostty, it became extremely slow. Perhaps it needs to delete registered images when applications close.
Another idea might be to support both original protocols and allow unicode placeholders only in the tmux environment, or when the user configures it...

@meck
Copy link
Author

meck commented Nov 27, 2025

Yes i noticed this as well, the issue is probably that all the images are re-transmitted on each update. It should keep a list of ids of currently displayed images (i.e. cached by the emulator) and just send the unicode for displaying that again.

Or simpler send all the images for the current list view up front and then just send the the unicode chars referencing them, then resend the images when the list changes. Kitty caches up to 320mb of images it seems like so there is also the possibly to to send things in advance

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