Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(desktop-gpui): say when Instant with a camera keeps the screen region, and spawn the restore

Richie McIlroy0fbf152c82ae
diff --git a/apps/desktop-gpui/src/app_windows.rs b/apps/desktop-gpui/src/app_windows.rs
index 3bc52cd11..daf91a106 100644
--- a/apps/desktop-gpui/src/app_windows.rs
+++ b/apps/desktop-gpui/src/app_windows.rs
@@ -2160,12 +2160,14 @@ fn restore_arranged_windows(cx: &mut App) {
return;
}
// Queued behind any move still running, which would otherwise land
- // after the restore. The job runs whether or not this is awaited.
- let _ = crate::foreign_window::in_order(move || {
- for window in arranged {
- crate::foreign_window::put_back(&window);
- }
- });
+ // after the restore.
+ cx.background_executor()
+ .spawn(crate::foreign_window::in_order(move || {
+ for window in arranged {
+ crate::foreign_window::put_back(&window);
+ }
+ }))
+ .detach();
}
pub fn dismiss_target_overlays(cx: &mut App) {
diff --git a/apps/desktop-gpui/src/target_overlay.rs b/apps/desktop-gpui/src/target_overlay.rs
index 133620c3f..0231c5114 100644
--- a/apps/desktop-gpui/src/target_overlay.rs
+++ b/apps/desktop-gpui/src/target_overlay.rs
@@ -2028,6 +2028,21 @@ impl OverlayWindow {
}
let theme = self.theme;
let focus = self.select.read(cx).focus_window;
+ // Instant records the camera bubble off the screen, so with a camera
+ // it keeps the screen region (see `instant_capture_window`).
+ let camera = cx
+ .global::<app_windows::AppWindows>()
+ .main
+ .read(cx)
+ .is_ok_and(|view| view.camera_selection().is_some());
+ let tooltip = if cfg!(any(target_os = "macos", windows))
+ && self.select.read(cx).recording_mode == Mode::Instant
+ && camera
+ {
+ "Centre this window. With a camera, Instant mode still records the screen region, so the camera stays in the video"
+ } else {
+ "Centre this window and record only it, nothing in front of it"
+ };
Some(
div()
.id("window-focus")
@@ -2040,13 +2055,7 @@ impl OverlayWindow {
.gap(px(10.))
.rounded_full()
.bg(gpui::hsla(0., 0., 0., 0.28))
- .tooltip(move |_, cx| {
- crate::ui::Tooltip::new(
- &theme,
- "Centre this window and record only it, nothing in front of it",
- )
- .view(cx)
- })
+ .tooltip(move |_, cx| crate::ui::Tooltip::new(&theme, tooltip).view(cx))
.on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())
.child(
div()