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

Feedback and suggestions for color palette notifications #1659

Open
gpanders opened this issue Nov 27, 2024 · 0 comments
Open

Feedback and suggestions for color palette notifications #1659

gpanders opened this issue Nov 27, 2024 · 0 comments

Comments

@gpanders
Copy link

Hi!

I've recently implemented support in Neovim for color palette notifications. Having implemented, I have some feedback and suggestions for ways it could be modified to help our use case.

We are using these notifications to detect when the background color of the terminal has changed. In Neovim's case, we don't care about the OS appearance (at least not right now), all we care about is the terminal's background color. When we receive one of these notifications we send an OSC 11 query to determine the terminal's background color and update the 'background' option appropriately.

However, we end up receiving a lot of these notifications because Neovim changes or resets the cursor color frequently (the user can set the 'guicursor' option which can modify the color and shape of the cursor based on the current mode). Every time this happens, we get a color palette update notification, we query the terminal's background color, and we update 'background'. This causes a lot of unnecessary "noise", both in unneeded terminal I/O but also in user-facing OptionSet events everytime 'background' is set (even if the option's value doesn't change).

Suggestions

Since all we (Neovim) care about is the terminal's background color, it would be great to be able to have more granularity about what changed in the DSR. I can think of two ways to do this:

  1. When we enable mode 2031, allow the application to specify which events it's interested in. In Neovim's case, we would "register" only for terminal background color changes. Other applications may choose to be notified for foreground color changes, or OS appearance changes. The drawback here is that I don't think this is possible with DECSET, since it doesn't take parameters.

  2. Include more parameters in the DSR response to indicate what actually has changed. The parameters would include e.g. 10 for a foreground color change, 11 for a background color change, 12 for a cursor color change, and perhaps 4 for a palette color change (to match the OSC sequences). So for instance, if the OS appearance changed to black and background color changed, the terminal would send CSI ? 997 ; 1 ; 11 n. With this approach, Neovim would know to only query for the background color when the terminal's background color changed.

Please let me know your thoughts. Thanks for spearheading this feature, a lot of our users are very excited about 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

No branches or pull requests

1 participant