add physical key mapping for useHotkeys to support alt keyboard languages (#2051)

This commit is contained in:
jeffvli
2026-05-26 21:55:08 -07:00
parent 57b11e0dae
commit e206136156
5 changed files with 130 additions and 16 deletions
+5 -1
View File
@@ -2,8 +2,10 @@ import {
type HotkeyItem as MantineHotkeyItem,
useHotkeys as useMantineHotkeys,
} from '@mantine/hooks';
import { useMemo } from 'react';
import { useAppStore } from '/@/renderer/store';
import { withPhysicalKeys } from '/@/shared/utils/hotkeys';
const EMPTY_HOTKEYS: MantineHotkeyItem[] = [];
@@ -13,8 +15,10 @@ export const useHotkeys = (
triggerOnContentEditable?: boolean,
) => {
const commandPaletteOpened = useAppStore((state) => state.commandPalette.opened);
const physicalHotkeys = useMemo(() => withPhysicalKeys(hotkeys), [hotkeys]);
useMantineHotkeys(
commandPaletteOpened ? EMPTY_HOTKEYS : hotkeys,
commandPaletteOpened ? EMPTY_HOTKEYS : physicalHotkeys,
tagsToIgnore,
triggerOnContentEditable,
);