Add an option to control quit on last window behavior

This commit is contained in:
Kovid Goyal 2018-06-07 08:03:47 +05:30
parent 23d089b4be
commit b9dd434fab
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 14 additions and 5 deletions

View File

@ -48,7 +48,9 @@ Changelog
working if no kitty window currently has focus. (:iss:`524`)
- macOS: Keep kitty running even when the last window is closed. This is in
line with how applications are supposed to behave on macOS (:iss:`543`)
line with how applications are supposed to behave on macOS (:iss:`543`).
There is a new option (:opt:`macos_quit_when_last_window_closed`) to control
this.
- macOS: Add macOS standard shortcuts for copy, paste and new OS window
(⌘+C, ⌘+V, ⌘+N)

View File

@ -749,7 +749,9 @@ process_pending_closes(ChildMonitor *self) {
} else has_open_windows = true;
}
#ifdef __APPLE__
if (!has_open_windows && !application_quit_requested()) has_open_windows = true;
if (!OPT(macos_quit_when_last_window_closed)) {
if (!has_open_windows && !application_quit_requested()) has_open_windows = true;
}
#endif
return has_open_windows;
}

View File

@ -657,14 +657,12 @@ probably better off just hiding the titlebar with :opt:`macos_hide_titlebar`.
o('macos_hide_titlebar', False, long_text=_('''
Hide the kitty window's title bar on macOS.'''))
o('x11_hide_window_decorations', False, long_text=_('''
Hide the window decorations (title bar and window borders) on X11 and Wayland.
Whether this works and exactly what effect it has depends on the window
manager, as it is the job of the window manager/compositor to draw window
decorations.'''))
o('macos_option_as_alt', True, long_text=_('''
Use the option key as an alt key. With this set to no, kitty will use
the macOS native :kbd:`Option+Key` = unicode character behavior. This will
@ -676,6 +674,12 @@ o('macos_hide_from_tasks', False, long_text=_('''
Hide the kitty window from running tasks (:kbd:`Option+Tab`) on macOS.
'''))
o('macos_quit_when_last_window_closed', False, long_text=_('''
Have kitty quit when all the top-level windows are closed. By default,
kitty will stay running, even with no open windows, as is the expected
behavior on macOS.
'''))
# }}}

View File

@ -385,6 +385,7 @@ PYWRAP1(set_options) {
S(window_alert_on_bell, PyObject_IsTrue);
S(macos_option_as_alt, PyObject_IsTrue);
S(macos_hide_titlebar, PyObject_IsTrue);
S(macos_quit_when_last_window_closed, PyObject_IsTrue);
S(x11_hide_window_decorations, PyObject_IsTrue);
S(macos_hide_from_tasks, PyObject_IsTrue);

View File

@ -23,7 +23,7 @@ typedef struct {
color_type url_color, background, active_border_color, inactive_border_color, bell_border_color;
double repaint_delay, input_delay;
bool focus_follows_mouse;
bool macos_option_as_alt, macos_hide_titlebar, macos_hide_from_tasks, x11_hide_window_decorations;
bool macos_option_as_alt, macos_hide_titlebar, macos_hide_from_tasks, x11_hide_window_decorations, macos_quit_when_last_window_closed;
int adjust_line_height_px, adjust_column_width_px;
float adjust_line_height_frac, adjust_column_width_frac;
float background_opacity, dim_opacity;