Extending the use of XTGETTCAP for feature discovery #12835
Replies: 2 comments
-
|
I did a search and no other common terminal exposes these as terminfo capabilities, except for tmux. That said, there doesn't seem to be a collision. I'm for this. |
Beta Was this translation helpful? Give feedback.
-
|
Just FYI,
I realise Ghostty is already diverging from these requirements (and I think also not responding in the correct format), so if that's intentional then it doesn't matter what further changes you make to the protocol. However, if you intend to be Xterm compatible, and actually follow the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
The current state of terminal feature discovery is wonderfully varied! Each terminal has its own approach. Some suggest to use DA1, others use extended Terminfo capabilities, and the rest leave it up to the application to figure it out. I think that's a good opportunity to find a better solution.
I think Terminfo databases feel like a relic of the past, and ideally we'd move beyond them. But that's not quite how technology evolves 😄 Terminals and escape sequences grew over decades and still going strong, so backwards compatibility is important. Xterm, the modern terminal standard, defines XTGETTCAP for applications to query Terminfo/Termcap capabilities. While it was introduced originally to query "for special keyboard keys", today many terminals (including Xterm itself) use it to expose their Terminfo database capabilities. This is great because it allows applications to discover capabilities over the wire instead of bundling them or relying on Ncurses or other TI database packages to exist on the system.
That brings me to how it's being used nowadays. Several applications already use XTGETTCAP to query capabilities like
RGB,setrgbf, andsetrgbb. Other known user-defined capabilities that are also commonly used include:Tcoriginated from TmuxMs(OSC52)Smulx(SGR 4:N)Setulc(SGR 58;2;...)Tmux also defines these:
Hls(OSC8)Swd(OSC7)Spb(OSC9;4)Someone might ask why not DA1? The way DA1 maps each attribute to a number is quite limiting, and DA1 attributes also conflict with well-known OSC identifiers like OSC8. String based capabilities are much richer and a natural fit for today's world, where transferring few extra bytes is basically free compared to the days of the DEC VT100.
So I'd love to propose extending the use of XTGETTCAP to query terminal features. In particular the many OSC ones that cannot be queried via DA1/2/3, DECRQS, DECRQSS, DSR, or others mechanisms. I'd like to suggest adding
Hls,Swd,Spb, and other commonly missing capabilities to Ghostty's Terminfo database so they become discoverable via XTGETTCAP. I think this would be a great step towards unifying the efforts to discover terminal capabilities by leveraging an existing, widely adopted protocol and well-established capability names.Beta Was this translation helpful? Give feedback.
All reactions