Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop): prevent camera restore after cleanup completes
Richie McIlroyb8fcf25cff79
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 1de5fd048..524b79c90 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -1081,13 +1081,18 @@ async fn cleanup_camera_window(app: AppHandle, session_id: u64) {label.starts_with("target-select-overlay-") && window.is_visible().unwrap_or(false)});+ let main_window_visible = CapWindowId::Main+ .get(&app)+ .and_then(|w| w.is_visible().ok())+ .unwrap_or(false);+let is_camera_only_mode = recording_settings::RecordingSettingsStore::get(&app).ok().flatten().and_then(|s| s.target).is_some_and(|t| matches!(t, ScreenCaptureTarget::CameraOnly));- if is_camera_only_mode {+ if is_camera_only_mode && main_window_visible {tracing::info!("Camera cleanup: preserving camera feed for camera-only mode");return;}@@ -4213,7 +4218,7 @@ fn restore_camera_window(app: &AppHandle) {let should_restore_camera = app.state::<ArcLock<App>>().try_read()- .map(|state| state.selected_camera_id.is_some())+ .map(|state| state.selected_camera_id.is_some() && !state.camera_cleanup_done).unwrap_or(false);if should_restore_camera {diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rsindex b06e5c9f6..6afe58324 100644--- a/apps/desktop/src-tauri/src/windows.rs+++ b/apps/desktop/src-tauri/src/windows.rs@@ -125,6 +125,7 @@ async fn ensure_camera_input_active(app_state: &mut App) {}app_state.camera_in_use = true;+ app_state.camera_cleanup_done = false;}}@@ -329,6 +330,12 @@ fn center_camera_window(app: &AppHandle, window: &WebviewWindow) {let _ = window.set_size(tauri::LogicalSize::new(window_width, window_height));app.state::<CameraWindowPositionGuard>().ignore_for(1000);let _ = window.set_position(tauri::LogicalPosition::new(pos_x, pos_y));++ if let Ok(guard) = state.try_read() {+ guard+ .camera_preview+ .notify_window_resized(window_width as u32, window_height as u32);+ }}fn is_position_on_display(display_id: &DisplayId, pos_x: f64, pos_y: f64) -> bool {