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 a separate color option for visuall bell #4181

Merged
merged 3 commits into from
Nov 3, 2021

Conversation

page-down
Copy link
Contributor

Provide independent color configuration option for visual bell, instead of only reusing the highlighted selection background color.

Because visuall bell renders in full window, users can choose to use less glaring dark colors.

It also allows theme customization and remote control.

Here is a custom alert bell effect with alternating red and blue colors.

kitty --config=NONE -o 'visual_bell_duration=0.3' -o allow_remote_control=yes sh -c 'for i in {1..3}; do kitty @ set-colors visual_bell_color=#ff0000; printf "\a"; sleep 0.3; kitty @ set-colors visual_bell_color=#0000ff; printf "\a"; sleep 0.6; done; kitty @ set-colors visual_bell_color=none; exec sh'

In addition, I added # generated by gen-config.py DO NOT edit to kitty/rc/set_colors.py nullable_colors.

Please check if it is appropriate and if there are any omissions, thank you.

@kovidgoyal
Copy link
Owner

Looks generally fine. Only concern is that is OSC 20 actually meant for this? I can find no reference for this. For instance the xterm ctlseqs page only mentions osc 19 and then 22.

If there is some reference please let me know otherwise leave out the bits that set these colors in tui/operations.py and window.py as its possible OSC 20 is used for something else.

@kovidgoyal
Copy link
Owner

Also i made the list of color keys in collection.py generated by gen-config.py as well.

@page-down
Copy link
Contributor Author

Looks generally fine. Only concern is that is OSC 20 actually meant for this? I can find no reference for this. ...
If there is some reference please let me know otherwise leave out the bits that set these colors in tui/operations.py and window.py as its possible OSC 20 is used for something else.

As far as I know OSC 20 is not used, I removed the relevant code. It looks like there is no escape sequence for visual bell color at the moment.

Also i made the list of color keys in collection.py generated by gen-config.py as well.

Thanks, I have updated it according to this.

@kovidgoyal
Copy link
Owner

There is one remaining issue. The selection bg color can itself be set
to none. So you cant use it as a fallback. You need to have a fallback
chain bell color -> selection bg -> default fg

@page-down
Copy link
Contributor Author

Fixed, now falls back to default foreground color when selection background color is none. Please check if it is appropriate.

@kovidgoyal kovidgoyal merged commit 76834c0 into kovidgoyal:master Nov 3, 2021
@page-down page-down deleted the feat-visual-bell-color branch November 3, 2021 10:15
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.

None yet

2 participants