mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-27 11:56:05 +02:00
fix(example) can't use tray icon to exit (#1183)
This commit is contained in:
@@ -145,10 +145,12 @@ pub fn run() {
|
||||
|
||||
app.run(move |_app_handle, _event| {
|
||||
#[cfg(desktop)]
|
||||
if let RunEvent::ExitRequested { api, .. } = &_event {
|
||||
// Keep the event loop running even if all windows are closed
|
||||
// This allow us to catch system tray events when there is no window
|
||||
api.prevent_exit();
|
||||
if let RunEvent::ExitRequested { code, api, .. } = &_event {
|
||||
if code.is_none() {
|
||||
// Keep the event loop running even if all windows are closed
|
||||
// This allow us to catch system tray events when there is no window
|
||||
api.prevent_exit();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user