diff options
Diffstat (limited to 'bundle/src-tauri')
| -rw-r--r-- | bundle/src-tauri/capabilities/default.json | 2 | ||||
| -rw-r--r-- | bundle/src-tauri/src/main.rs | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/bundle/src-tauri/capabilities/default.json b/bundle/src-tauri/capabilities/default.json index a9c7253..4efbe87 100644 --- a/bundle/src-tauri/capabilities/default.json +++ b/bundle/src-tauri/capabilities/default.json @@ -2,5 +2,5 @@ "$schema": "../gen/schemas/desktop-schema.json", "identifier": "main", "windows": ["*"], - "permissions": ["core:default", "core:window:allow-set-title", "core:window:allow-close", "dialog:default"] + "permissions": ["core:default", "core:window:allow-set-title", "core:window:allow-close", "core:window:allow-destroy", "dialog:default"] } diff --git a/bundle/src-tauri/src/main.rs b/bundle/src-tauri/src/main.rs index c361260..7dbccd9 100644 --- a/bundle/src-tauri/src/main.rs +++ b/bundle/src-tauri/src/main.rs @@ -117,7 +117,16 @@ fn main() { .build(tauri::generate_context!()) .expect("Could not start CPSC Bundle") .run(|app, event| match event { - // Also reached when macOS terminates without closing windows, such as Dock Quit. + // Dock Quit must run the same document-close flow as the menu and title bar. + tauri::RunEvent::ExitRequested { api, code: None, .. } => { + let windows = app.webview_windows(); + if !windows.is_empty() { + api.prevent_exit(); + for window in windows.into_values() { + let _ = window.close(); + } + } + } tauri::RunEvent::Exit => { let runners: Vec<Runner> = app .state::<Runners>() |
