fix(tray): prevent exit when chat window closes
Switched from Builder::run() to Builder::build() + App::run(event_handler) so ExitRequested can be intercepted. Without this, the hidden chat window failing to load localhost:1420 triggered a clean exit and Robin disappeared from the tray silently.
This commit is contained in:
parent
efec0a53ee
commit
5142e29ad9
1 changed files with 10 additions and 2 deletions
|
|
@ -104,6 +104,14 @@ pub fn run() {
|
|||
commands::panel_closed,
|
||||
commands::chat,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running Robin");
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error building Robin")
|
||||
.run(|_app, event| {
|
||||
// Robin lives in the system tray. Prevent the process from exiting
|
||||
// when the chat window is closed or hidden — only the tray "Quit"
|
||||
// menu item should terminate the app.
|
||||
if let tauri::RunEvent::ExitRequested { api, .. } = event {
|
||||
api.prevent_exit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue