macos: close all windows

Fixes #1052

This implements a `close_all_windows` binding in the core and implements
it for macOS specifically. This will ask for close confirmation if any
surface in any of the windows requires confirmation.

This is bound by default to option+shift+command+w to match Safari. The
binding is generall option+command+w but users may expect this to also
mean "Close All Other Tabs" which is the changed behavior if any tabs
are present in a standard macOS application. So I chose to follow Safari
instead.

This doesn't implement this feature for GTK, that's left as an exercise
for a contributor.
This commit is contained in:
Mitchell Hashimoto
2023-12-17 20:38:52 -08:00
parent b6ed5f7e4a
commit 97433d3aa1
7 changed files with 83 additions and 3 deletions

View File

@@ -221,12 +221,18 @@ pub const Action = union(enum) {
reload_config: void,
/// Close the current "surface", whether that is a window, tab, split,
/// etc. This only closes ONE surface.
/// etc. This only closes ONE surface. This will trigger close confirmation
/// as configured.
close_surface: void,
/// Close the window, regardless of how many tabs or splits there may be.
/// This will trigger close confirmation as configured.
close_window: void,
/// Close all windows. This will trigger close confirmation as configured.
/// This only works for macOS currently.
close_all_windows: void,
/// Toggle fullscreen mode of window.
toggle_fullscreen: void,