Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(desktop-gpui): keep the main window hidden after an Instant recording
Richie McIlroy48eee6c5c542
diff --git a/apps/desktop-gpui/src/app_windows.rs b/apps/desktop-gpui/src/app_windows.rsindex 93b540b0b..6d9c3b599 100644--- a/apps/desktop-gpui/src/app_windows.rs+++ b/apps/desktop-gpui/src/app_windows.rs@@ -613,12 +613,14 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, cif !restore_clean_capture_ui(cx) {return;}- let (finished_studio, preparing_editor) = session.update(cx, |session, _| {- (- session.finished_studio.take(),- session.take_preparing_studio_editor(),- )- });+ let (finished_studio, preparing_editor, finished_instant) =+ session.update(cx, |session, _| {+ (+ session.finished_studio.take(),+ session.take_preparing_studio_editor(),+ std::mem::take(&mut session.finished_instant),+ )+ });// The in-editor re-record target is consumed first, before// `postStudioRecordingBehaviour` is even consulted -- the order// `apply_post_studio_editor_behaviour` checks them@@ -657,8 +659,14 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c// away. `doNothing` leaves it in the library with Cap out of// the way. Every other path (instant, failures, `showOverlay`// until an overlay exists) reshows the main window as before.- let behaviour =- crate::store::GeneralSettings::load().post_studio_recording_behaviour;+ // A clean instant recording reshows it only for "Show Cap";+ // otherwise the browser tab, or the copied link alone, is+ // the completion and Cap stays out of the way.+ let settings = crate::store::GeneralSettings::load();+ let behaviour = settings.post_studio_recording_behaviour;+ let keep_hidden_after_instant = finished_instant+ && settings.post_instant_behaviour()+ != crate::store::PostInstantBehaviour::ShowCap;match (finished_studio, behaviour) {(Some(project_dir), crate::store::PostStudioBehaviour::OpenEditor) => {open_editor(project_dir, cx)@@ -667,6 +675,10 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, cpark_idle_camera_preview(cx);crate::menus::schedule_dock_sync(cx);}+ (None, _) if keep_hidden_after_instant => {+ park_idle_camera_preview(cx);+ crate::menus::schedule_dock_sync(cx);+ }_ => show_main_window(cx),}}@@ -920,6 +932,7 @@ pub(crate) fn show_main_window_after_capture_pause(cx: &mut App) {// before the window is visible again.platform::restore_borderless_style(native);platform::show_native(native);+ tracing::info!("main window shown");}// The unit-3 macOS 26 display-link repair, and the reason a window// hidden before its FIRST paint reshows as nothing at all: AppKitdiff --git a/apps/desktop-gpui/src/session.rs b/apps/desktop-gpui/src/session.rsindex 20ef9f7ec..dadecc053 100644--- a/apps/desktop-gpui/src/session.rs+++ b/apps/desktop-gpui/src/session.rs@@ -434,6 +434,10 @@ pub struct RecordingSession {/// Taken by the phase observer to honour `postStudioRecordingBehaviour`/// (`openEditor` by default) the way the Tauri app does.pub finished_studio: Option<std::path::PathBuf>,+ /// An instant recording stopped cleanly and its share link was handed+ /// out. Taken by the phase observer, which brings the main window back+ /// only for the "Show Cap" Instant outcome.+ pub finished_instant: bool,preparing_studio_editor: Option<PreparingStudioEditor>,/// `EditorRecordingTarget` (`src-tauri/src/windows.rs:3679-3697`): the/// open editor project a "Record a new clip" capture must land back in.@@ -497,6 +501,7 @@ impl RecordingSession {controls_open: false,mic_muted: false,finished_studio: None,+ finished_instant: false,preparing_studio_editor: None,editor_recording_target: None,started_at: None,@@ -1378,6 +1383,7 @@ impl RecordingSession {let separator = if link.contains('?') { '&' } else { '?' };cx.open_url(&format!("{link}{separator}recordingStopped=1"));}+ this.finished_instant = !low_storage;cx.write_to_clipboard(gpui::ClipboardItem::new_string(link));}}