🐛 debug windows close

This commit is contained in:
Tw93
2024-12-21 21:07:06 +08:00
parent c5a8c68e82
commit a25dfa9179

View File

@@ -100,24 +100,24 @@ pub fn run_app() {
Ok(())
})
.on_window_event(|window, event| {
#[cfg(target_os = "macos")]
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
{
let window_handle = window.clone();
tauri::async_runtime::spawn(async move {
if window_handle.is_fullscreen().unwrap_or(false) {
window_handle.set_fullscreen(false).unwrap();
// Give a small delay to ensure the full-screen exit operation is completed.
tokio::time::sleep(Duration::from_millis(900)).await;
}
window_handle.minimize().unwrap();
window_handle.hide().unwrap();
});
api.prevent_close();
}
}
})
// .on_window_event(|window, event| {
// #[cfg(target_os = "macos")]
// if let tauri::WindowEvent::CloseRequested { api, .. } = event {
// {
// let window_handle = window.clone();
// tauri::async_runtime::spawn(async move {
// if window_handle.is_fullscreen().unwrap_or(false) {
// window_handle.set_fullscreen(false).unwrap();
// // Give a small delay to ensure the full-screen exit operation is completed.
// tokio::time::sleep(Duration::from_millis(900)).await;
// }
// window_handle.minimize().unwrap();
// window_handle.hide().unwrap();
// });
// api.prevent_close();
// }
// }
// })
.run(tauri::generate_context!())
.expect("error while running tauri application");
}