Fix shortcut capture ignoring - = ; ' keys (#2047)

* Fix shortcut capture ignoring - = ; ' keys

KEY_MAP was missing Minus/Equal/Semicolon/Quote, so
keyboardEventToComboString returned null for those physical keys and
the capture UI silently dropped them. Add the four entries with their
shifted variants.

Also suppress the Electron View > Zoom accelerators (Cmd+-/=/0) while
capturing, so those combos reach the renderer instead of zooming the
window. Driven by the existing capturingShortcut flag via a new
paseo:menu:set-capturing-shortcut IPC.

* fix: address review feedback from PR #2047

Trim the capturing useEffect so it only fires when capture is active
(removes the redundant on-mount false and the double-fire on true->false),
and reset the main-process capturingShortcut flag on renderer reload via
browser-window-created + did-finish-load so a Cmd+R mid-capture can't
leave the zoom accelerators disabled.

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
OnCloud
2026-07-14 13:30:32 +02:00
committed by GitHub
co-authored by Mohamed Boudra
parent 9ea58aae0c
commit c0b801b805
6 changed files with 127 additions and 2 deletions
@@ -23,6 +23,7 @@ import { useKeyboardShortcutsStore } from "@/stores/keyboard-shortcuts-store";
import { getShortcutOs } from "@/utils/shortcut-platform";
import { getIsElectronRuntime } from "@/constants/layout";
import { isNative } from "@/constants/platform";
import { getDesktopHost } from "@/desktop/host";
const EMPTY_CAPTURED_COMBOS: string[] = [];
@@ -169,6 +170,7 @@ export function KeyboardShortcutsSection() {
const { overrides, hasOverrides, setOverride, removeOverride, resetAll } =
useKeyboardShortcutOverrides();
const setCapturingShortcut = useKeyboardShortcutsStore((s) => s.setCapturingShortcut);
const capturing = useKeyboardShortcutsStore((s) => s.capturingShortcut);
const isFocused = useIsFocused();
const isMac = getShortcutOs() === "mac";
@@ -242,6 +244,17 @@ export function KeyboardShortcutsSection() {
};
}, [setCapturingShortcut]);
// Suppress desktop zoom accelerators while capturing so combos like Cmd+- are
// recorded instead of zooming the window. No-op outside Electron.
useEffect(() => {
if (isNative || !capturing) return;
const menu = getDesktopHost()?.menu;
void menu?.setCapturingShortcut?.(true);
return () => {
void menu?.setCapturingShortcut?.(false);
};
}, [capturing]);
const handleResetAll = useCallback(() => void resetAll(), [resetAll]);
const handleRemoveOverride = useCallback(
(bindingId: string) => void removeOverride(bindingId),