Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(desktop-gpui): clear the blocked shortcut notice once editing works

Richie McIlroyc8a1d13b2baf
diff --git a/apps/desktop-gpui/src/hotkeys.rs b/apps/desktop-gpui/src/hotkeys.rs
index 5bc37215e..4154ced24 100644
--- a/apps/desktop-gpui/src/hotkeys.rs
+++ b/apps/desktop-gpui/src/hotkeys.rs
@@ -205,8 +205,7 @@ pub fn pause(cx: &mut App) -> bool {
if !cx.has_global::<Hotkeys>() || cx.global::<Hotkeys>().paused {
return true;
}
- #[cfg(target_os = "linux")]
- if cx.global::<Hotkeys>().capture_stop.is_some() {
+ if editing_blocked(cx) {
return false;
}
unregister_all(cx);
@@ -217,6 +216,19 @@ pub fn pause(cx: &mut App) -> bool {
true
}
+pub fn editing_blocked(cx: &App) -> bool {
+ #[cfg(target_os = "linux")]
+ if cx
+ .try_global::<Hotkeys>()
+ .is_some_and(|hotkeys| hotkeys.capture_stop.is_some())
+ {
+ return true;
+ }
+ #[cfg(not(target_os = "linux"))]
+ let _ = cx;
+ false
+}
+
/// End a [`pause`] and register the store's bindings again. Returns whether
/// anything was paused; without a pause the registrations are left alone.
pub fn resume(cx: &mut App) -> bool {
diff --git a/apps/desktop-gpui/src/settings_pages.rs b/apps/desktop-gpui/src/settings_pages.rs
index 05f0acd66..62b3f926b 100644
--- a/apps/desktop-gpui/src/settings_pages.rs
+++ b/apps/desktop-gpui/src/settings_pages.rs
@@ -1716,7 +1716,8 @@ impl SettingsWindow {
let red: Hsla = theme.red_11.into();
let amber: Hsla = theme.amber_11.into();
- let blocked = self.pages.shortcut_blocked == Some(action);
+ let blocked =
+ self.pages.shortcut_blocked == Some(action) && crate::hotkeys::editing_blocked(cx);
let (detail, detail_color, detail_icon): (String, Hsla, Option<(&str, Hsla)>) = if blocked {
(BLOCKED_WHILE_RECORDING.into(), red, None)
} else if let Some(listening) = listening {