diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 33f2937..a18910f 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -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(); + } + }); }