From 5142e29ad9850958b99c6e6e748de4fc833dc337 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Wed, 20 May 2026 11:10:24 -0700 Subject: [PATCH] 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. --- src-tauri/src/lib.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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(); + } + }); }