Skip to content

Query iterm2 support#88

Draft
hasezoey wants to merge 4 commits intoatanunq:masterfrom
hasezoey:queryIterm2Support
Draft

Query iterm2 support#88
hasezoey wants to merge 4 commits intoatanunq:masterfrom
hasezoey:queryIterm2Support

Conversation

@hasezoey
Copy link
Contributor

@hasezoey hasezoey commented Nov 11, 2025

This PR implements a way to query iterm2 inline image protocol support.

This has recently been published at iterm2: Terminal Feature Reporting

re #84
re #79

Depends on #86 and #85

This is a DRAFT as of now the \x1b]1337;Capabilities\x07 query is undocumented and only implemented by iterm2 itself, see the iterm2 discussion.
This will stay a DRAFT until at least some other terminal implements this.

Anyone who is on macos and uses iterm2, i would appreciate testing with viu against this PR with the following viu patch applied and report the Iterm2 Response log:
For convenience, use my fork of viu at branch testIterm2Query (it sets to only use iterm2 protocol and points viuer dependency to this PR branch)

@j4james
Copy link

j4james commented Nov 12, 2025

Have you tried using an OSC 1337;ReportCellSize query as I suggested on the Mintty issue? I know not all IIP terminals support it, but I'm sure a few of them do, and it's much more likely to be supported than 1337;Capabilities.

@hasezoey
Copy link
Contributor Author

Have you tried using an OSC 1337;ReportCellSize query as I suggested on the Mintty issue?

I did not, as that is not really part of the iterm2 protocol spec, so who would really know about that? (i had also tried searching around, but didnt find anything related, aside from the already mentioned gitlab issue)
In any case, yes it would likely be a OK indicator of iterm2 support, but it is not explicit, and due to it not being part of the spec there are some terminals which dont support it. For example, the terminals i tested / looked at their code:

terminal iterm2 supported ReportCellSize
konsole Y Y
wezterm Y Y
vscode-term Y*1 N
rio Y*2 N
kitty N N
alacritty N N
  • *1 vscode image support (iterm&kitty) is toggle-able
  • *2 rio's support is very minimal, only supporting the legacy File, not MultipartFile

Though it would still be a good idea, in my opinion, to add OSC 1337 ; Capabilities as that is now defined in the iterm2 image protocol spec, and more explicit than OSC 1337;ReportCellSize.

But thanks for pointing this out, it could be a ok indicator until Capabilities (or something else explicit) is more widely available.

@hasezoey
Copy link
Contributor Author

Updated the implementation to fall-back to checking for ReportCellSize availability after checking Capabilities first.

@j4james
Copy link

j4james commented Nov 13, 2025

I did not, as that is not really part of the iterm2 protocol spec, so who would really know about that?

I can't remember where exactly, but it was suggested in an issue of one of the terminals that supports IIP. The iTerm2 maintainer was pinged in the discussion, and I'm certain he said he would add that to the spec, but I guess that never happened if it's not there now.

It doesn't make a lot of difference to me either way, because I don't use iTerm2 images, but I figured it would be a lot easier to get a few more terminals supporting ReportCellSize, than to try and convince all of them to support the more controversial Capabilities spec, just so you can lookup one capability from it.

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