From ca77214e2d543883553af799a586da3a898807e9 Mon Sep 17 00:00:00 2001 From: byGalax Date: Sat, 16 May 2026 16:41:20 +0200 Subject: [PATCH] fix(desktop): voice hotkeys are window-scoped unless Global is toggled The old code registered every enabled hotkey through Electron globalShortcut API, which captures system-wide. Setting M as mute meant m could not be typed in any other app. Now the OS-level registration only happens when binding.global === true; otherwise the existing window-keydown listener handles it. --- apps/desktop/src/context/CallContext.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/desktop/src/context/CallContext.tsx b/apps/desktop/src/context/CallContext.tsx index 39a3ef9..a316843 100644 --- a/apps/desktop/src/context/CallContext.tsx +++ b/apps/desktop/src/context/CallContext.tsx @@ -2004,14 +2004,16 @@ export function CallProvider({ children }: { children: ReactNode }) { const syncGlobalShortcuts = () => { if (!isTauriRuntime()) return; + // Only register an OS-level shortcut if the user explicitly opted in. + // Window-scoped firing happens via the `onKey` listener above and works + // for every enabled binding regardless of the `global` flag. + const enabledAndGlobal = (b: VoiceHotkeys[HotkeyKind]) => b.enabled && b.global; const desired: Record = { - mute: settings.mute.enabled ? bindingToTauriShortcut(settings.mute) : null, - deafen: settings.deafen.enabled ? bindingToTauriShortcut(settings.deafen) : null, - hangup: settings.hangup.enabled ? bindingToTauriShortcut(settings.hangup) : null, - screenShare: settings.screenShare.enabled - ? bindingToTauriShortcut(settings.screenShare) - : null, - video: settings.video.enabled ? bindingToTauriShortcut(settings.video) : null, + mute: enabledAndGlobal(settings.mute) ? bindingToTauriShortcut(settings.mute) : null, + deafen: enabledAndGlobal(settings.deafen) ? bindingToTauriShortcut(settings.deafen) : null, + hangup: enabledAndGlobal(settings.hangup) ? bindingToTauriShortcut(settings.hangup) : null, + screenShare: enabledAndGlobal(settings.screenShare) ? bindingToTauriShortcut(settings.screenShare) : null, + video: enabledAndGlobal(settings.video) ? bindingToTauriShortcut(settings.video) : null, }; for (const kind of KINDS) { const want = desired[kind];