Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Hide overlay windows before taking screenshots
Richie McIlroyd7cc2badfd9b
diff --git a/apps/desktop/src-tauri/src/general_settings.rs b/apps/desktop/src-tauri/src/general_settings.rsindex aa9a8b5f3..eb4641290 100644--- a/apps/desktop/src-tauri/src/general_settings.rs+++ b/apps/desktop/src-tauri/src/general_settings.rs@@ -64,6 +64,11 @@ const DEFAULT_EXCLUDED_WINDOW_TITLES: &[&str] = &["Cap Settings","Cap Recording Controls","Cap Camera",+ "Cap Target Select",+ "Cap Window Capture Occluder",+ "Cap Capture Area",+ "Cap Mode Selection",+ "Cap Recordings Overlay",];pub fn default_excluded_windows() -> Vec<WindowExclusion> {diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rsindex 41791dd4f..ea551b88a 100644--- a/apps/desktop/src-tauri/src/recording.rs+++ b/apps/desktop/src-tauri/src/recording.rs@@ -1477,6 +1477,27 @@ pub async fn take_screenshot(None,);+ let mut hid_any = false;+ for (label, window) in app.webview_windows() {+ if let Ok(id) = CapWindowId::from_str(&label) {+ if matches!(+ id,+ CapWindowId::TargetSelectOverlay { .. }+ | CapWindowId::WindowCaptureOccluder { .. }+ | CapWindowId::CaptureArea+ | CapWindowId::ModeSelect+ | CapWindowId::RecordingsOverlay+ ) {+ hide_overlay(&window);+ hid_any = true;+ }+ }+ }++ if hid_any {+ tokio::time::sleep(std::time::Duration::from_millis(150)).await;+ }+let image = capture_screenshot(target).await.map_err(|e| format!("Failed to capture screenshot: {e}"))?;diff --git a/apps/desktop/src/routes/target-select-overlay.tsx b/apps/desktop/src/routes/target-select-overlay.tsxindex 5c2a7e967..e940c7235 100644--- a/apps/desktop/src/routes/target-select-overlay.tsx+++ b/apps/desktop/src/routes/target-select-overlay.tsx@@ -1740,11 +1740,19 @@ function RecordingControls(props: {if (rawOptions.mode === "screenshot") {try {+ const allWindows = await WebviewWindow.getAll();+ for (const win of allWindows) {+ if (win.label.startsWith("target-select-overlay-")) {+ await win.setIgnoreCursorEvents(true);+ await win.hide();+ }+ }+const path = await invoke<string>("take_screenshot", {target: props.target,});- commands.showWindow({ ScreenshotEditor: { path } });- commands.closeTargetSelectOverlays();+ await commands.showWindow({ ScreenshotEditor: { path } });+ await commands.closeTargetSelectOverlays();} catch (e) {const message = e instanceof Error ? e.message : String(e);toast.error(`Failed to take screenshot: ${message}`);