🐛 debug windows

This commit is contained in:
Tw93
2024-12-21 22:43:08 +08:00
parent 66616ff23c
commit 28c9d9010d
2 changed files with 3 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ pub fn set_system_tray(app: &AppHandle) -> tauri::Result<()> {
} }
"quit" => { "quit" => {
let _res = app.save_window_state(StateFlags::all()); let _res = app.save_window_state(StateFlags::all());
app.get_webview_window("pake").unwrap().close().unwrap(); std::process::exit(0);
} }
_ => (), _ => (),
}) })

View File

@@ -102,11 +102,9 @@ pub fn run_app() {
Ok(()) Ok(())
}) })
.on_window_event(|window, event| { .on_window_event(|window, event| {
#[cfg(target_os = "macos")]
if let tauri::WindowEvent::CloseRequested { api, .. } = event { if let tauri::WindowEvent::CloseRequested { api, .. } = event {
let window = window.clone(); let window = window.clone();
api.prevent_close();
#[cfg(target_os = "macos")]
{ {
tauri::async_runtime::spawn(async move { tauri::async_runtime::spawn(async move {
if window.is_fullscreen().unwrap_or(false) { if window.is_fullscreen().unwrap_or(false) {
@@ -118,9 +116,7 @@ pub fn run_app() {
window.hide().unwrap(); window.hide().unwrap();
}); });
} }
api.prevent_close();
#[cfg(not(target_os = "macos"))]
std::process::exit(0);
} }
}) })
.run(tauri::generate_context!()) .run(tauri::generate_context!())