A new option single_window_padding_width to use a different padding when only a single window is visible

Fixes #6734
This commit is contained in:
Kovid Goyal
2023-10-20 08:37:45 +05:30
parent 512a672398
commit 4b997a961c
10 changed files with 52 additions and 10 deletions

View File

@@ -1026,6 +1026,17 @@ bottom and left.
'''
)
opt('single_window_padding_width', '-1',
option_type='optional_edge_width',
long_text='''
The window padding to use when only a single window is visible (in pts). Negative
values will cause the value of :opt:`window_padding_width` to be used instead. A
single value sets all four sides. Two values set the vertical and horizontal
sides. Three values set top, horizontal and bottom. Four values set top, right,
bottom and left.
'''
)
opt('placement_strategy', 'center',
choices=('center', 'top-left'),
long_text='''

View File

@@ -934,7 +934,7 @@ class Parser:
raise ValueError(f"The value {val} is not a valid choice for default_pointer_shape")
ans["default_pointer_shape"] = val
choices_for_default_pointer_shape = frozenset(('arrow', 'beam', 'text', 'pointer', 'hand', 'help', 'wait', 'progress', 'crosshair', 'vertical-text', 'move', 'e-resize', 'ne-resize', 'nw-resize', 'n-resize', 'se-resize', 'sw-resize', 's-resize', 'w-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', 'alias', 'copy', 'not-allowed', 'no-drop', 'grab', 'grabbing'))
choices_for_default_pointer_shape = frozenset(('arrow', 'beam', 'text', 'pointer', 'hand', 'help', 'wait', 'progress', 'crosshair', 'cell', 'vertical-text', 'move', 'e-resize', 'ne-resize', 'nw-resize', 'n-resize', 'se-resize', 'sw-resize', 's-resize', 'w-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', 'alias', 'copy', 'not-allowed', 'no-drop', 'grab', 'grabbing'))
def detect_urls(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['detect_urls'] = to_bool(val)
@@ -1202,6 +1202,9 @@ class Parser:
def single_window_margin_width(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['single_window_margin_width'] = optional_edge_width(val)
def single_window_padding_width(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['single_window_padding_width'] = optional_edge_width(val)
def startup_session(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['startup_session'] = config_or_absolute_path(val)

View File

@@ -16,7 +16,7 @@ import kitty.types
choices_for_allow_cloning = typing.Literal['yes', 'y', 'true', 'no', 'n', 'false', 'ask']
choices_for_allow_remote_control = typing.Literal['password', 'socket-only', 'socket', 'no', 'n', 'false', 'yes', 'y', 'true']
choices_for_background_image_layout = typing.Literal['mirror-tiled', 'scaled', 'tiled', 'clamped', 'centered', 'cscaled']
choices_for_default_pointer_shape = typing.Literal['arrow', 'beam', 'text', 'pointer', 'hand', 'help', 'wait', 'progress', 'crosshair', 'vertical-text', 'move', 'e-resize', 'ne-resize', 'nw-resize', 'n-resize', 'se-resize', 'sw-resize', 's-resize', 'w-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', 'alias', 'copy', 'not-allowed', 'no-drop', 'grab', 'grabbing']
choices_for_default_pointer_shape = typing.Literal['arrow', 'beam', 'text', 'pointer', 'hand', 'help', 'wait', 'progress', 'crosshair', 'cell', 'vertical-text', 'move', 'e-resize', 'ne-resize', 'nw-resize', 'n-resize', 'se-resize', 'sw-resize', 's-resize', 'w-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out', 'alias', 'copy', 'not-allowed', 'no-drop', 'grab', 'grabbing']
choices_for_linux_display_server = typing.Literal['auto', 'wayland', 'x11']
choices_for_macos_colorspace = typing.Literal['srgb', 'default', 'displayp3']
choices_for_macos_show_window_title_in = typing.Literal['all', 'menubar', 'none', 'window']
@@ -407,6 +407,7 @@ option_names = ( # {{{
'shell_integration',
'show_hyperlink_targets',
'single_window_margin_width',
'single_window_padding_width',
'startup_session',
'strip_trailing_spaces',
'symbol_map',
@@ -563,6 +564,7 @@ class Options:
shell_integration: typing.FrozenSet[str] = frozenset({'enabled'})
show_hyperlink_targets: bool = False
single_window_margin_width: FloatEdges = FloatEdges(left=-1.0, top=-1.0, right=-1.0, bottom=-1.0)
single_window_padding_width: FloatEdges = FloatEdges(left=-1.0, top=-1.0, right=-1.0, bottom=-1.0)
startup_session: typing.Optional[str] = None
strip_trailing_spaces: choices_for_strip_trailing_spaces = 'never'
sync_to_monitor: bool = True