Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9665f85
feat(recording): switch the microphone or camera mid-recording from t…
richiemcilroy Nov 14, 2026
f5289cb
test(recording): keep the switched mic test clear of the stereo downmix
richiemcilroy Nov 14, 2026
b83d989
style: rustfmt
richiemcilroy Nov 14, 2026
5111f53
fix(desktop): build the input switch against the async app update
richiemcilroy Nov 14, 2026
99f628a
test(desktop): debug deeplink to switch the recording microphone
richiemcilroy Nov 14, 2026
8b81ccd
test(recording): av-sync-record can record a mic and switch it mid-re…
richiemcilroy Nov 14, 2026
33123e6
fix(recording): build the microphone switch on Windows and keep clipp…
richiemcilroy Nov 14, 2026
28d6021
fix(desktop): keep switching and pausing exclusive, size the Linux ba…
richiemcilroy Nov 14, 2026
20af7a1
chore(desktop): drop an unused switch error dismissal
richiemcilroy Nov 14, 2026
b3a7adf
fix(desktop): restart with the switched inputs and keep the Linux bar…
richiemcilroy Nov 14, 2026
348c73b
fix(desktop): size the Linux settings panel from the room below the bar
richiemcilroy Nov 14, 2026
6e7682f
test(linux): find the wider recording bar in the desktop harness
richiemcilroy Nov 15, 2026
688f491
Merge remote-tracking branch 'origin/main' into feat/gpui-recording-s…
richiemcilroy Nov 16, 2026
3bcd343
fix(desktop): keep the Instant camera until the new one opens
richiemcilroy Nov 17, 2026
f324b37
fix(desktop): reopen a hidden Linux camera preview after recording
richiemcilroy Nov 17, 2026
1251521
fix(recording): keep audio in place across an Instant microphone switch
richiemcilroy Nov 17, 2026
f49a886
test(recording): feed the switch timeline test in real time
richiemcilroy Nov 17, 2026
0253920
fix(desktop): leave the camera alone when Stop lands during a switch
richiemcilroy Nov 17, 2026
b2729ab
fix(desktop): reopen a hidden camera preview after a clean capture ends
richiemcilroy Nov 17, 2026
bb37a1e
test(desktop): pin that Stop ends a pending camera switch
richiemcilroy Nov 17, 2026
e78a6b1
Merge remote-tracking branch 'origin/main' into feat/gpui-recording-s…
richiemcilroy Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/desktop-gpui/locales/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,14 @@ starting = "Startet"
[controls.marker]
add = "Marker hinzufügen"

[controls.settings]
locked = "In dieser Aufnahme nicht änderbar"
not_in_recording = "Nicht in dieser Aufnahme"
open = "Aufnahmeeinstellungen"
show_camera_preview = "Kameravorschau anzeigen"
switch_failed = "Wechsel zu {device} nicht möglich. Die Aufnahme läuft weiter."
switching = "Wird gewechselt…"

[camera]
waiting_title = "Warten auf Kamerazugriff"

Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/locales/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,14 @@ starting = { text = "Starting", max_px = 73, size = 14 }
[controls.marker]
add = "Add marker"

[controls.settings]
locked = "Can't change in this recording"
not_in_recording = "Not in this recording"
open = "Recording settings"
show_camera_preview = "Show camera preview"
switch_failed = "Couldn't switch to {device}. The recording continues."
switching = "Switching…"

[camera]
waiting_title = "Waiting for camera access"

Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/locales/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,14 @@ starting = "Iniciando"
[controls.marker]
add = "Añadir marcador"

[controls.settings]
locked = "No se puede cambiar en esta grabación"
not_in_recording = "No está en esta grabación"
open = "Ajustes de grabación"
show_camera_preview = "Mostrar vista previa de la cámara"
switch_failed = "No se pudo cambiar a {device}. La grabación continúa."
switching = "Cambiando…"

[camera]
waiting_title = "Esperando acceso a la cámara"

Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/locales/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,14 @@ starting = "Début"
[controls.marker]
add = "Ajouter un repère"

[controls.settings]
locked = "Non modifiable dans cet enregistrement"
not_in_recording = "Absent de cet enregistrement"
open = "Réglages d'enregistrement"
show_camera_preview = "Afficher l'aperçu de la caméra"
switch_failed = "Impossible de passer à {device}. L'enregistrement continue."
switching = "Changement…"

[camera]
waiting_title = "En attente de l'accès à la caméra"

Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/locales/hi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,14 @@ starting = "शुरू हो रहा"
[controls.marker]
add = "मार्कर जोड़ें"

[controls.settings]
locked = "इस रिकॉर्डिंग में बदला नहीं जा सकता"
not_in_recording = "इस रिकॉर्डिंग में नहीं"
open = "रिकॉर्डिंग सेटिंग्स"
show_camera_preview = "कैमरा प्रीव्यू दिखाएँ"
switch_failed = "{device} पर स्विच नहीं हो सका। रिकॉर्डिंग जारी है।"
switching = "बदला जा रहा है…"

[camera]
waiting_title = "कैमरा एक्सेस का इंतज़ार है"

Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/locales/ja.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,14 @@ starting = "開始中"
[controls.marker]
add = "マーカーを追加"

[controls.settings]
locked = "この録画では変更できません"
not_in_recording = "この録画では未使用"
open = "録画設定"
show_camera_preview = "カメラプレビューを表示"
switch_failed = "{device} に切り替えられませんでした。録画は続行中です。"
switching = "切り替え中…"

[camera]
waiting_title = "カメラへのアクセスを待っています"

Expand Down
8 changes: 8 additions & 0 deletions apps/desktop-gpui/locales/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,14 @@ starting = "正在开始"
[controls.marker]
add = "添加标记"

[controls.settings]
locked = "本次录制中无法更改"
not_in_recording = "本次录制未使用"
open = "录制设置"
show_camera_preview = "显示摄像头预览"
switch_failed = "无法切换到 {device}。录制仍在继续。"
switching = "正在切换…"

[camera]
waiting_title = "正在等待摄像头权限"

Expand Down
126 changes: 115 additions & 11 deletions apps/desktop-gpui/src/app_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ use crate::{

/// Matches the Tauri `InProgressRecording` window and
/// `fake_window.rs` position math.
pub const CONTROLS_WIDTH: f32 = 320.;
pub const CONTROLS_WIDTH: f32 = 352.;
pub const CONTROLS_HEIGHT: f32 = 150.;
/// The bar alone, with its padding. A transparent window takes every click
/// inside its frame, so without an issue to show the window is only this
/// tall and the app under the empty space above the bar stays clickable.
pub const CONTROLS_BAR_HEIGHT: f32 = 64.;
const CONTROLS_FIT_TO_ISSUE: bool = cfg!(any(target_os = "macos", windows));
const CONTROLS_BOTTOM_OFFSET: f64 = 120.;
pub(crate) const CONTROLS_BOTTOM_OFFSET: f64 = 120.;
const TARGET_CONTROLS_OFFSET_Y: f64 = 48.;

#[cfg(any(target_os = "macos", test))]
Expand Down Expand Up @@ -309,6 +309,10 @@ pub struct AppWindows {
/// Where the camera bubble sat before a window picker parked it inside the
/// highlighted window -- see [`CameraPark`].
pub camera_park: CameraPark,
/// The recording bar's "Show camera preview" turned the bubble off. It
/// is hidden, not closed, so a Studio capture keeps excluding the same
/// window when it comes back.
camera_preview_hidden: bool,
#[cfg(target_os = "linux")]
clean_capture: Option<CleanCaptureUi>,
#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -578,6 +582,7 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c
main_closed_by_user: false,
editor_hidden_for_picker: None,
camera_park: CameraPark::default(),
camera_preview_hidden: false,
#[cfg(target_os = "linux")]
clean_capture: None,
#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -637,10 +642,15 @@ pub fn init(main: WindowHandle<MainWindow>, session: Entity<RecordingSession>, c
}
close_controls(&session, cx);
close_target_overlays(cx);
// The clean-capture lease keeps the bubble closed until it is
// released, so the hidden preview reopens only after it.
#[cfg(target_os = "linux")]
if !restore_clean_capture_ui(cx) {
return;
}
if cx.global::<AppWindows>().camera_preview_hidden {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hidden camera preview stays closed after a Wayland clean capture ends

Medium Severity

On Linux under Wayland, a Display or Area clean capture (clean_capture_supported accepts those targets regardless of wayland) is started with the bar's Show camera preview turned off, so camera_preview_hidden is true and the bubble is closed. When the recording stops, the Idle observer runs restore_clean_capture_ui at app_windows.rs:648; for a lease with wayland set it calls begin_retained_capture_restore and returns false, so the early return skips the reopen at lines 651-653. The asynchronous completion in begin_retained_capture_restore (the Ok arm that takes the clean_capture lease) only calls update_camera_presentation(true), which returns with no camera window, and it never calls set_camera_preview_shown. The retained set for Wayland holds only the main window (app_windows.rs:3718-3722), so nothing else reopens the bubble. camera_preview_hidden therefore stays true and the toggle reads off until the user re-enables it. The new comment's claim that the hidden preview reopens after the lease is released does not hold on Wayland. Before this head the flag was cleared and the bubble also stayed closed, so this is an incomplete fix of the same path rather than a new regression. Fix: in the Wayland completion, after the lease is taken, call set_camera_preview_shown(true, cx) when camera_preview_hidden is set, as the observer does on X11. Verified by static trace only; no run was performed.

Open in Capy

set_camera_preview_shown(true, cx);
}
let (finished_studio, studio_behaviour, preparing_editor, finished_instant, deleted) =
session.update(cx, |session, _| {
(
Expand Down Expand Up @@ -3113,6 +3123,7 @@ fn own_windows(cx: &mut App) -> Vec<OwnWindowHandle> {
main_closed_by_user: _,
editor_hidden_for_picker: _,
camera_park: _,
camera_preview_hidden: _,
#[cfg(target_os = "linux")]
clean_capture: _,
#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -4428,6 +4439,7 @@ pub fn open_camera_window(cx: &mut App) {
}

pub fn close_camera_window(cx: &mut App) {
cx.global_mut::<AppWindows>().camera_preview_hidden = false;
if let Some(handle) = cx.global_mut::<AppWindows>().camera.take() {
#[cfg(not(target_os = "macos"))]
if let Some(previous) = handle
Expand Down Expand Up @@ -7254,6 +7266,63 @@ pub fn arm_target_mode(kind: crate::main_window::TargetType, cx: &mut App) {
.ok();
}

#[cfg(target_os = "macos")]
pub(crate) fn camera_window_id(cx: &mut App) -> Option<scap_targets::WindowId> {
camera_window_number(cx).and_then(|number| number.to_string().parse().ok())
}

pub(crate) fn camera_preview_shown(cx: &App) -> bool {
let windows = cx.global::<AppWindows>();
windows.camera.is_some() && !windows.camera_preview_hidden
}

/// The bar's "Show camera preview". Hides and shows the bubble in place;
/// Linux has no native hide for it, so there it closes and reopens.
pub(crate) fn set_camera_preview_shown(shown: bool, cx: &mut App) {
let Some(handle) = cx.global::<AppWindows>().camera else {
if shown {
open_camera_window(cx);
// A bubble that could not open yet (a clean capture still holds
// it) stays hidden, so the next reopen tries again.
if cx.global::<AppWindows>().camera.is_some() {
cx.global_mut::<AppWindows>().camera_preview_hidden = false;
}
}
return;
};
#[cfg(target_os = "linux")]
{
let _ = handle;
if !shown {
close_camera_window(cx);
// Closing clears the flag; keep the choice so the end of the
// recording reopens the preview, as the other platforms do.
cx.global_mut::<AppWindows>().camera_preview_hidden = true;
}
Comment thread
richiemcilroy marked this conversation as resolved.
Resolved
}
#[cfg(not(target_os = "linux"))]
{
if cx.global::<AppWindows>().camera_preview_hidden != shown {
return;
}
cx.global_mut::<AppWindows>().camera_preview_hidden = !shown;
let native = handle
.update(cx, |_, window, _| platform::native_window(window))
.ok()
.flatten();
if let Some(native) = native {
cx.spawn(async move |_| {
if shown {
platform::order_front_native(&native);
} else {
platform::hide_native(&native);
}
})
.detach();
}
}
}

fn camera_window_number(cx: &mut App) -> Option<isize> {
let handle = cx.global::<AppWindows>().camera?;
handle
Expand Down Expand Up @@ -7313,15 +7382,11 @@ fn controls_origin(config: &StartConfig) -> (f64, f64) {
}
}

/// Grow the bar's window upward to make room for an issue card above the
/// bar, or shrink it back to the bar alone, leaving the bar where it is.
/// `setFrame` re-enters gpui, so call this from a task.
pub(crate) fn fit_controls_to_issue(native: &platform::NativeWindow, issue: bool, scale: f32) {
let height = f64::from(if issue {
CONTROLS_HEIGHT
} else {
CONTROLS_BAR_HEIGHT
});
/// Grow the bar's window upward to `height` to make room for the cards above
/// the bar (an issue, the settings panel), or shrink it back, leaving the bar
/// where it is. `setFrame` re-enters gpui, so call this from a task.
pub(crate) fn fit_controls(native: &platform::NativeWindow, height: f32, scale: f32) {
let height = f64::from(height);
let (x, y, width, current) = platform::window_frame(native);
if width <= 0. {
return;
Expand Down Expand Up @@ -8239,11 +8304,50 @@ mod tests {
main_closed_by_user: false,
editor_hidden_for_picker: None,
camera_park: CameraPark::default(),
camera_preview_hidden: false,
clean_capture: None,
clean_capture_generation: 0,
}
}

/// Linux hides the bar's camera preview by closing its window. The choice
/// must survive the close, or the end of the recording never reopens it.
#[cfg(target_os = "linux")]
#[gpui::test]
fn a_hidden_linux_camera_preview_is_reopened_after_recording(cx: &mut gpui::TestAppContext) {
cx.update(|cx| {
let mut windows = test_app_windows(Vec::new());
windows.camera = Some(WindowHandle::new((u64::MAX - 1).into()));
cx.set_global(windows);
assert!(camera_preview_shown(cx));
set_camera_preview_shown(false, cx);
assert!(!camera_preview_shown(cx));
assert!(cx.global::<AppWindows>().camera.is_none());
assert!(cx.global::<AppWindows>().camera_preview_hidden);
});
}

/// A clean capture keeps the bubble closed until its lease is released.
/// Asking to show the preview while the lease holds must keep it hidden,
/// so the reopen after the lease is released still brings it back.
#[cfg(target_os = "linux")]
#[gpui::test]
fn a_hidden_camera_preview_stays_hidden_while_a_clean_capture_holds_it(
cx: &mut gpui::TestAppContext,
) {
cx.update(|cx| {
let mut windows = test_app_windows(Vec::new());
let mut lease = pending_clean_capture(RecordingMode::Studio, false);
lease.gate.started = true;
windows.clean_capture = Some(lease);
windows.camera_preview_hidden = true;
cx.set_global(windows);
set_camera_preview_shown(true, cx);
assert!(cx.global::<AppWindows>().camera.is_none());
assert!(cx.global::<AppWindows>().camera_preview_hidden);
});
}

#[cfg(target_os = "linux")]
struct DeleteOrigin;

Expand Down
Loading
Loading