diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index cdb9c4c..8c12d13 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -9,6 +9,7 @@ use rig::streaming::StreamingChoice; use rig::{completion::Prompt, providers::anthropic}; use std::sync::{Arc, Mutex}; use std::{thread, time}; +use tauri::RunEvent; use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_clipboard_manager::ClipboardExt; @@ -271,6 +272,13 @@ pub fn run() { }); Ok(()) }) + .on_window_event(|app, event| match event { + tauri::WindowEvent::CloseRequested { api, .. } => { + app.hide().unwrap(); + api.prevent_close(); + } + _ => {} + }) .invoke_handler(tauri::generate_handler![]) .run(tauri::generate_context!()) .expect("error while running tauri application");