diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rs index f356ed6b92..7270a65055 100644 --- a/apps/desktop/src-tauri/src/recording.rs +++ b/apps/desktop/src-tauri/src/recording.rs @@ -47,6 +47,7 @@ use std::{ time::Duration, }; use tauri::{AppHandle, Manager, path::BaseDirectory}; +use tauri_plugin_global_shortcut::GlobalShortcutExt; use tauri_plugin_dialog::{DialogExt, MessageDialogBuilder}; use tauri_specta::Event; use tracing::*; @@ -3010,6 +3011,20 @@ async fn handle_recording_end( let _ = window.hide(); } + // Destroy any target-select overlays that were hidden when recording started + // so they don't reappear when the main window comes back. + let focus_manager = handle.try_state::(); + for (label, window) in handle.webview_windows() { + if let Ok(CapWindowId::TargetSelectOverlay { display_id }) = + CapWindowId::from_str(&label) + { + hide_overlay(&window); + if let Some(ref fm) = focus_manager { + fm.destroy(&display_id, handle.global_shortcut()); + } + } + } + if let Some(camera) = CapWindowId::Camera.get(&handle) { let _ = camera.hide(); } diff --git a/apps/desktop/src-tauri/src/windows.rs b/apps/desktop/src-tauri/src/windows.rs index 602af5ed72..2d97c446fb 100644 --- a/apps/desktop/src-tauri/src/windows.rs +++ b/apps/desktop/src-tauri/src/windows.rs @@ -2347,10 +2347,12 @@ impl ShowCapWindow { } #[cfg(windows)] - if let Some(bounds) = display.raw_handle().physical_bounds() { + if let Some(bounds) = display.raw_handle().logical_bounds() { window_builder = window_builder .inner_size(bounds.size().width(), bounds.size().height()) .position(bounds.position().x(), bounds.position().y()); + } else { + window_builder = window_builder.inner_size(100.0, 100.0).position(0.0, 0.0); } #[cfg(target_os = "linux")] @@ -2376,6 +2378,7 @@ impl ShowCapWindow { )); } + #[cfg(target_os = "macos")] crate::platform::set_window_level( window.as_ref().window(),