Xithrius / twitch-tui

Twitch chat in the terminal.
https://xithrius.github.io/twitch-tui/
Apache License 2.0
431 stars 32 forks source link

Support more graphics APIs for emojis #605

Closed codenyte closed 2 months ago

codenyte commented 2 months ago

Is your feature request related to a problem? Please describe. Not every terminal uses the Kitty Graphics Protocol. iTerm has its own graphics protocol, and SIXEL is a much more universal solution.

Describe the solution you'd like Consider supporting the iTerm2 Graphics protocol and SIXEL to improve compatibility of the emoji feature with more terminal emulators.

Xithrius commented 2 months ago

Thank you for the issue!

This was in the back of my mind for a while, and I feared the implementation process. It was only a matter of time until it was requested. Hopefully it's not too bad, I'll start looking into the different protocols soonish.

Xithrius commented 2 months ago

@Nogesma since you implemented the emote system, what are your thoughts for doing this in SIXEL? I'd like to take a shot if we need to do a rewrite of the graphics protocol, since SIXEL looks to be the most promising (and universal, already supporting iTerm2), but also pretty different from the kitty graphics protocol.

EDIT: I misunderstood. iTerm2 is supported with SIXEL, but kitty does not, having its own graphics protocol. Looks like the implementation would just be adding SIXEL's protocol, and detection of what terminal is currently running.

Nogesma commented 2 months ago

I had a quick look and it seems like sixel lacks a lot of features compared to the kitty graphics protocol, that we are currently using with twt.

It does not support using Unicode placeholders to display images, which means we would have to go back to tracking the images placement manually, and update them on each refresh. Additionally, we would also need to render a new image for every emote/overlay pair, as it doesn't seem like sixel supports Z axis placement, nor relative placements. I also didn't find anything about animated images in the protocol.

It would honestly add a lot of complexity, because we would need to reimplement some of the features of the kitty graphics protocol on our side.

If this is a popular request, there's always a possibility to add basic support for it, with no overlays or animated images, but it would probably not be easy, and I remember my last implementation that manually moved images was still a bit buggy.

I haven't really looked at iTerm2, and I do not have a computer that runs macOS, so I can't really help on that side.

Xithrius commented 2 months ago

In that case, I agree in waiting to see if this is a popular enough request to spend time implementing it.

Xithrius commented 2 months ago

I'll close this as not planned for now.