feat(win32): support dead-key hotkeys via native keyboard hook#341
Open
hanselstner wants to merge 1 commit intoOpenWhispr:mainfrom
Open
feat(win32): support dead-key hotkeys via native keyboard hook#341hanselstner wants to merge 1 commit intoOpenWhispr:mainfrom
hanselstner wants to merge 1 commit intoOpenWhispr:mainfrom
Conversation
On non-US keyboard layouts (e.g. German QWERTZ), certain keys like the circumflex are dead keys -- they do not produce a character on their own and are invisible to Electron's globalShortcut API. This commit adds support for dead-key hotkeys by: - Mapping circumflex/Caret to VK_OEM_5 in the native Windows key listener (windows-key-listener.c) - Detecting dead keys (e.key === "Dead") in HotkeyInput and resolving them via a dead-key override map - Adding a hasNonStandardKey() helper that routes these keys through the native Windows keyboard hook instead of globalShortcut - Swallowing captured key events in the hook to prevent dead-key characters from leaking into focused text fields Tested on Windows 11 with German QWERTZ layout using circumflex as the dictation hotkey in both tap and push-to-talk modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds native Windows low-level keyboard hook support for dead-key hotkeys (e.g.,
^on German QWERTZ,`on US layouts). These keys are consumed by the OS input method before Electron'sglobalShortcutAPI can detect them.Changes
resources/windows-key-listener.c: Add dead-key virtual key code mapping (VK_OEM_1–VK_OEM_8) so the native listener recognises keys like^,`,~,´src/helpers/windowsKeyManager.js: Map dead-key characters to their VK names and route them to the native binarysrc/helpers/hotkeyManager.js: Detect dead keys and delegate to the native Windows listener instead of Electron'sglobalShortcutsrc/components/ui/HotkeyInput.tsx: Capture rawevent.codefor dead keys (which produce noevent.keyvalue) and map to the printable charactersrc/hooks/useHotkey.js: SkipglobalShortcutpolling for dead-key hotkeys since they're handled nativelyTest plan
^as the dictation hotkey^does not leak the character into focused text fieldsPull Request opened by Augment Code with guidance from the PR author