From 1489a92e62301dea8f8ddda485052ed34add0296 Mon Sep 17 00:00:00 2001 From: noelcserepy <24229685+noelcserepy@users.noreply.github.com> Date: Fri, 9 Oct 2026 09:48:25 +0200 Subject: [PATCH 1/2] Close welcome and settings when a capture starts Activating the app for a capture unhid every window it owned, so a welcome or settings window left open came back with each hotkey press. --- src/main.rs | 6 ++++++ src/welcome.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index afe2810..1a303fd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -115,6 +115,12 @@ fn capture(cx: &mut App) { } state.capturing = true; let style = state.settings.style.clone(); + // Activating the app brings all of its windows forward, so close the ones a capture has no use for. + for window in cx.windows() { + if window.downcast::().is_some() || window.downcast::().is_some() { + window.update(cx, |_, window, _| window.remove_window()).ok(); + } + } // macOS only lets us take focus right after the user's key press. Take it now, so // focus comes back to us when screencapture exits and the editor opens in front. cx.activate(true); diff --git a/src/welcome.rs b/src/welcome.rs index 87f8b7d..0739973 100644 --- a/src/welcome.rs +++ b/src/welcome.rs @@ -21,7 +21,7 @@ pub fn open(cx: &mut App) { .ok(); } -struct Welcome; +pub struct Welcome; impl Render for Welcome { fn render(&mut self, _: &mut Window, cx: &mut Context) -> impl IntoElement { From ed2b219d4866bc7d3e399a72bb92deb386144822 Mon Sep 17 00:00:00 2001 From: noelcserepy <24229685+noelcserepy@users.noreply.github.com> Date: Fri, 9 Oct 2026 09:56:13 +0200 Subject: [PATCH 2/2] Restore the capture hotkey when the settings view is released Capture closes settings with remove_window, which skips on_window_should_close, so closing mid-recording left the hotkey off. --- src/main.rs | 8 +------- src/settings.rs | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1a303fd..852bcc1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -163,13 +163,7 @@ pub fn open_settings(cx: &mut App) { let handle = cx.open_window(options, |window, cx| { // Windows opens new windows behind the app in front. window.activate_window(); - let view = cx.new(|cx| SettingsView::new(window, cx)); - // Never leave the shortcut disabled because the window closed mid-recording. - window.on_window_should_close(cx, |_, cx| { - AppState::set_hotkey_enabled(true, cx); - true - }); - view + cx.new(|cx| SettingsView::new(window, cx)) }); cx.global_mut::().settings_window = handle.ok(); } diff --git a/src/settings.rs b/src/settings.rs index 5672c41..ae897f6 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -269,6 +269,8 @@ impl SettingsView { pub fn new(window: &mut Window, cx: &mut Context) -> Self { let focus = cx.focus_handle(); window.focus(&focus); + // However the window closes, never leave the shortcut disabled mid-recording. + cx.on_release(|_, cx| AppState::set_hotkey_enabled(true, cx)).detach(); Self { focus, tab: Tab::Appearance, recording: None, font_search: None, families: render::families(), preview: None } }