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

Add support for OSC 22 #7119

Open
kchibisov opened this issue Jul 28, 2023 · 9 comments · May be fixed by #7244
Open

Add support for OSC 22 #7119

kchibisov opened this issue Jul 28, 2023 · 9 comments · May be fixed by #7244

Comments

@kchibisov
Copy link
Member

This allows setting a cursor shape, the names are X11 names which should be just
passed as is to winit. We may want to have an option to disable it.

The use case is to have a better mouse mode support in some applications.

The escape is supported by: foot, xterm. The docs are on https://invisible-island.net/xterm/ctlseqs/ctlseqs.html . If the shape doesn't exist we can ignore the event.

@chrisduerr
Copy link
Member

The use case is to have a better mouse mode support in some applications.

How does this improve mouse mode support? I'd argue that this makes mouse mode support much worse, because now you can't be sure which mode you're in anymore.

I'm generally not a huge fan of window ops and this one seems to have some obvious drawbacks?

@kchibisov
Copy link
Member Author

@chrisduerr in general it's nice to have a resize cursor for tmux panes, loading cursor when you have some action running to provide an aditional indication. it's true that you can't judge by default/text cursor anymore, but only if the application sets the text cursor itself, though most can select.

Like it basically provides a visual indication that you can do something which you won't show otherwise with any reasonable mechanism. This option is opt-in in terminal applications in general, so it's not like it'll heart, but I'll use it myself.

@rockorager
Copy link

As an application developer, there are few downsides I see to this one. Terminals either ignore it, or respect it. Users of those respecting OSC22 get better hinting at usability. The few shapes I really care about are resize shapes, cell shapes, clickable, and busy/backround busy shapes. All of these provide huge UI improvements when using a mouse in a TUI.

@chrisduerr
Copy link
Member

I'm definitely not sold at all, so at the very least it would require an option to disable this escape.

I'd assume there's no capability for this?

@rockorager
Copy link

@chrisduerr There is no query for this one, nor any terminfo cap that I'm aware of. Here's a quick demo.

@j4james
Copy link

j4james commented Jul 29, 2023

Just FYI, if you care about cross-platform support, this sequence isn't great. On XTerm the cursor styles come directly from Xlib, but the only other terminal I know of that supports OSC 22 is Mintty, whose implementation is based on the Windows cursor names.

And some of the X styles are just bizarre: things like "bogosity", "gumby", and "gobbler". It's like a 90's Geocities web page. The Windows styles are more reasonably thought out, but there's very little overlap between the two. The only names in common are "arrow" and "cross", although technically "ibeam" also works, because that's the fallback in both terminals.

This is something that could definitely do with standardization, even if it's just an agreed upon subset of common names.

Edit: I see now that foot supports this as well. I'm guessing that's also using the X names, although I haven't tested.

@kchibisov
Copy link
Member Author

w3c css cursors names must be used, everything else in such case is nonsense.

@j4james
Copy link

j4james commented Jul 29, 2023

w3c css cursors names must be used, everything else in such case is nonsense.

Yeah. That make perfect sense to me. I've just been looking at the foot implementation, and it appears that's actually what they're doing. Although it seems like they also include some aliases for compatibility with the X names.

@kchibisov
Copy link
Member Author

That's because they are Wayland terminal and cursor-shape protocol uses w3c cursors as well.

kchibisov added a commit to kchibisov/alacritty that referenced this issue Sep 28, 2023
Add support for OSC 22 escape sequence to allow changing mouse cursor
shapes. While the escape sequence could help some users with the mouse
UX in TUI applications using mouse mode, it could obscure common mouse
mode indication which is the `Text` cursor. Thus OSC 22 is disabled by
default and could be enabled with `terminal.osc22` configuration option.

Fixes alacritty#7119.
@kchibisov kchibisov linked a pull request Sep 28, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants