From 21eb7861f1ca534b39b81a08a49c843c29ee48b6 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 02:53:04 +0000 Subject: fix(bundle): ask about unsaved changes when quitting with Cmd+Q The predefined macOS Quit terminated the app without closing its windows, so their unsaved-changes prompts never ran. Quit now closes every window and the app exits after the last one. Co-Authored-By: Claude Opus 5.5 --- bundle/src-tauri/src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bundle/src-tauri/src/main.rs') diff --git a/bundle/src-tauri/src/main.rs b/bundle/src-tauri/src/main.rs index 9f63fc5..0da6815 100644 --- a/bundle/src-tauri/src/main.rs +++ b/bundle/src-tauri/src/main.rs @@ -93,11 +93,12 @@ fn main() { .menu(menu::build) // Menu items act on the focused window, like its keyboard shortcuts. .on_menu_event(|app, event| { - let focused = app - .webview_windows() - .into_values() - .find(|window| window.is_focused().unwrap_or(false)); - if let Some(window) = focused { + let mut windows = app.webview_windows().into_values(); + if event.id() == "quit" { + // Each window runs its unsaved-changes prompt; the app exits after the last. + windows.for_each(|window| drop(window.close())); + } else if let Some(window) = windows.find(|window| window.is_focused().unwrap_or(false)) + { let _ = window.emit_to(window.label(), "menu", event.id().as_ref()); } }) -- cgit v1.3.1-4-g156e