mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 03:01:57 +02:00
Do not count background processes by default for confirm_os_window_close
Fixes #8358
This commit is contained in:
@@ -1236,9 +1236,7 @@ Specify your preference as a string of characters.
|
||||
'''
|
||||
)
|
||||
|
||||
opt('confirm_os_window_close', '-1',
|
||||
option_type='int',
|
||||
long_text='''
|
||||
opt('confirm_os_window_close', '-1', option_type='confirm_close', long_text='''
|
||||
Ask for confirmation when closing an OS window or a tab with at least this
|
||||
number of kitty windows in it by window manager (e.g. clicking the window close
|
||||
button or pressing the operating system shortcut to close windows) or by the
|
||||
@@ -1247,10 +1245,11 @@ also applies to requests to quit the entire application (all OS windows, via the
|
||||
:ac:`quit` action). Negative values are converted to positive ones, however,
|
||||
with :opt:`shell_integration` enabled, using negative values means windows
|
||||
sitting at a shell prompt are not counted, only windows where some command is
|
||||
currently running or is running in the background. Note that if you want confirmation
|
||||
when closing individual windows, you can map the :ac:`close_window_with_confirmation` action.
|
||||
'''
|
||||
)
|
||||
currently running. You can also have backgrounded jobs prevent closing,
|
||||
by adding :code:`count-background` ot the setting, for example: :code:`-1 count-background`.
|
||||
Note that if you want confirmation when closing individual windows,
|
||||
you can map the :ac:`close_window_with_confirmation` action.
|
||||
''')
|
||||
egr() # }}}
|
||||
|
||||
|
||||
|
||||
4
kitty/options/parse.py
generated
4
kitty/options/parse.py
generated
@@ -10,7 +10,7 @@ from kitty.conf.utils import (
|
||||
from kitty.options.utils import (
|
||||
action_alias, active_tab_title_template, allow_hyperlinks, bell_on_tab, box_drawing_scale,
|
||||
clear_all_mouse_actions, clear_all_shortcuts, clipboard_control, clone_source_strategies,
|
||||
config_or_absolute_path, copy_on_select, cursor_blink_interval, cursor_text_color,
|
||||
config_or_absolute_path, confirm_close, copy_on_select, cursor_blink_interval, cursor_text_color,
|
||||
cursor_trail_decay, deprecated_adjust_line_height, deprecated_hide_window_decorations_aliases,
|
||||
deprecated_macos_show_window_title_in_menubar_alias, deprecated_send_text, disable_ligatures,
|
||||
edge_width, env, filter_notification, font_features, hide_window_decorations, macos_option_as_alt,
|
||||
@@ -906,7 +906,7 @@ class Parser:
|
||||
ans['command_on_bell'] = to_cmdline(val)
|
||||
|
||||
def confirm_os_window_close(self, val: str, ans: dict[str, typing.Any]) -> None:
|
||||
ans['confirm_os_window_close'] = int(val)
|
||||
ans['confirm_os_window_close'] = confirm_close(val)
|
||||
|
||||
def copy_on_select(self, val: str, ans: dict[str, typing.Any]) -> None:
|
||||
ans['copy_on_select'] = copy_on_select(val)
|
||||
|
||||
2
kitty/options/types.py
generated
2
kitty/options/types.py
generated
@@ -506,7 +506,7 @@ class Options:
|
||||
clone_source_strategies: frozenset[str] = frozenset({'conda', 'env_var', 'path', 'venv'})
|
||||
close_on_child_death: bool = False
|
||||
command_on_bell: list[str] = ['none']
|
||||
confirm_os_window_close: int = -1
|
||||
confirm_os_window_close: tuple[int, bool] = (-1, False)
|
||||
copy_on_select: str = ''
|
||||
cursor: kitty.fast_data_types.Color | None = Color(204, 204, 204)
|
||||
cursor_beam_thickness: float = 1.5
|
||||
|
||||
@@ -1007,6 +1007,13 @@ def shell_integration(x: str) -> frozenset[str]:
|
||||
return q
|
||||
|
||||
|
||||
def confirm_close(x: str) -> tuple[int, bool]:
|
||||
parts = x.split(maxsplit=1)
|
||||
num = int(parts[0])
|
||||
allow_background = len(parts) > 1 and parts[1] == 'count-background'
|
||||
return num, allow_background
|
||||
|
||||
|
||||
def underline_exclusion(x: str) -> tuple[float, Literal['', 'px', 'pt']]:
|
||||
try:
|
||||
return float(x), ''
|
||||
|
||||
Reference in New Issue
Block a user