Support negative inactive_text_alpha values for active-window-only fading

This commit is contained in:
zhaolei
2026-04-09 13:03:04 +08:00
parent 7bb73a3c54
commit 40c2012eeb
5 changed files with 30 additions and 8 deletions

View File

@@ -1397,10 +1397,13 @@ opt('bell_border_color', '#ff5a00',
)
opt('inactive_text_alpha', '1.0',
option_type='unit_float', ctype='float',
option_type='signed_unit_float', ctype='float',
long_text='''
Fade the text in inactive windows by the specified amount (a number between zero
and one, with zero being fully faded).
Fade the text in inactive windows by the specified amount. This must be a
number between negative one and one. The absolute value controls the actual
opacity, with zero being fully faded and one being fully opaque. Negative
values cause fading to be applied based only on whether the current window is
active, ignoring the extra single-window unfocused case.
'''
)

View File

@@ -4,8 +4,8 @@
import typing
import collections.abc # noqa: F401, RUF100
from kitty.conf.utils import (
merge_dicts, positive_float, positive_int, python_string, to_bool, to_cmdline, to_color,
to_color_or_none, unit_float
merge_dicts, positive_float, positive_int, python_string, signed_unit_float, to_bool, to_cmdline,
to_color, to_color_or_none, unit_float
)
from kitty.options.utils import (
action_alias, active_tab_title_template, allow_hyperlinks, bell_on_tab, box_drawing_scale,
@@ -1045,7 +1045,7 @@ class Parser:
ans['inactive_tab_foreground'] = to_color(val)
def inactive_text_alpha(self, val: str, ans: dict[str, typing.Any]) -> None:
ans['inactive_text_alpha'] = unit_float(val)
ans['inactive_text_alpha'] = signed_unit_float(val)
def initial_window_height(self, val: str, ans: dict[str, typing.Any]) -> None:
ans['initial_window_height'] = window_size(val)