fix(hotkey): resolve physical-key codes; Super-as-modifier; surface backend registration errors
Three correctness fixes to the hotkey recorder based on dogfood logs: 1. Modifier set now includes Super / OS / Hyper (webkit2gtk on Linux fires e.key === "Super" for the Windows key — previously that key got captured as the final trigger, producing invalid 'Ctrl+Shift+Super' strings the evdev parser rejected). 2. resolveTriggerKey() uses e.code (physical, shift-independent key) to resolve shifted punctuation back to the unshifted name the evdev parser understands: '+' -> '=', '|' -> '\\', etc. Letters and digits also use e.code (KeyA -> A, Digit1 -> 1) to avoid layout quirks. 3. Numpad keys intentionally not mapped to main-keyboard equivalents — they are distinct evdev codes. Leaves the parser to reject them so the user gets a toast instead of a silently-wrong binding. Registration failures now surface as a toast and revert settings.globalHotkey to the last successfully-registered value (if any), so the UI cannot lie about what is actually bound. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -117,6 +117,17 @@
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Hotkey registration failed:", err);
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
toasts.error(
|
||||
"Hotkey not registered",
|
||||
`${hotkey} — ${msg}. Reverted to ${registeredHotkey ?? "previous value"}.`,
|
||||
);
|
||||
// Revert the in-memory setting to the last successfully-registered hotkey
|
||||
// so the UI does not lie about what is actually bound.
|
||||
if (registeredHotkey && registeredHotkey !== hotkey) {
|
||||
settings.globalHotkey = registeredHotkey;
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user