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.
This commit is contained in:
@@ -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<HotkeyKind, string | null> = {
|
||||
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];
|
||||
|
||||
Reference in New Issue
Block a user