YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: closing pipe window (#1317)
tribhuwanc90d42a65a8d
diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rsindex 1db540bc9..8250e4007 100644--- a/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -97,6 +97,19 @@ pub fn show_main_window(app_handle: &tauri::AppHandle<tauri::Wry>, overlay: boolif !overlay {let _ = window.set_focus();}++ // event listener for the window close event+ let window_clone = window.clone();+ window.on_window_event(move |event| {+ if let tauri::WindowEvent::CloseRequested { api, .. } = event {+ if window_clone.is_fullscreen().unwrap_or(false) {+ let _ = window_clone.destroy().unwrap();+ } else {+ let _ = window_clone.hide().unwrap();+ api.prevent_close();+ }+ }+ });} else {let _ = tauri::WebviewWindowBuilder::new(app_handle,@@ -280,6 +293,28 @@ pub async fn open_pipe_window(}};+ // flag to prevent infinite loop+ let is_closing = std::sync::Arc::new(std::sync::Mutex::new(false));+ let is_closing_clone = std::sync::Arc::clone(&is_closing);++ // event listener for the window close event+ let window_clone = window.clone();+ window.on_window_event(move |event| {+ if let tauri::WindowEvent::CloseRequested { api, .. } = event {+ let mut is_closing = is_closing_clone.lock().unwrap();+ if *is_closing {+ return;+ }+ *is_closing = true;+ if window_clone.is_fullscreen().unwrap_or(false) {+ let _ = window_clone.destroy().unwrap();+ } else {+ api.prevent_close();+ let _ = window_clone.close().unwrap();+ }+ }+ });+// Only try to manipulate window if creation succeededif let Err(e) = window.set_focus() {error!("failed to set window focus: {}", e);