Conversation
…ames The key recorders named any key they had no rule for after the character it typed, so punctuation was saved as KEY_., KEY_;, KEY_/ ... and a shortcut or TTS stop key containing one could never fire. Right Ctrl/Alt/ Shift/Super were folded onto the left names, so they fired only from the left key, and the keypad was saved as the top-row digits. - Move the three copies of mapBrowserKeyToEvdev (wizard, Settings -> Hotkeys, TTS stop key) into src/lib/keys.ts and map by KeyboardEvent.code: punctuation, keypad, right-side modifiers, PrintScreen, ContextMenu, IntlBackslash and media keys. This also fixes the TTS stop key recorder, which saved letters as KEYV. - Test every emitted name against keymap::NAMES in win_keys.rs. - Migrate the broken names on load (bindings.toml and tts.stop_key), folding the existing KEY_ESCAPE -> KEY_ESC migration into it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nv8xwn4yhHm9dqmz6fuBtv
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.
Problem
The shortcut recorders named any key they had no rule for after the character it typed. Punctuation was saved as
KEY_.,KEY_,,KEY_/,KEY_;and so on. No hotkey backend reports those names, so a binding or TTS stop key that included one was saved but could never fire.The same mapping had two more bugs:
KeyMatchercompares names exactly, so the binding fired only from the left key.Numpad1was saved asKEY_1(the top-row key) andNumpadEnterasKEY_NUMPADENTER.There were also three copies of
mapBrowserKeyToEvdev: inwizard-data.ts, inHotkeysTab.svelteand inTtsTab.svelte. The TTS copy was missing theKey[A-Z]rule, so a letter stop key was saved asKEYV.Changes
src/lib/keys.ts(new): onemapBrowserKeyToEvdev, used by the wizard (through the existing re-export inwizard-data.ts), Settings → Hotkeys and the TTS stop key. It maps byKeyboardEvent.code, which is layout-independent:Period→KEY_DOT,Comma→KEY_COMMA,Slash,Semicolon,Quote→KEY_APOSTROPHE,Backquote→KEY_GRAVE,Minus,Equal,BracketLeft/BracketRight→KEY_LEFTBRACE/KEY_RIGHTBRACE,Backslash,IntlBackslash→KEY_102NDKEY_RIGHTCTRL,KEY_RIGHTALT,KEY_RIGHTSHIFT,KEY_RIGHTMETAKEY_KP0…KEY_KP9,KEY_KPDOT,KEY_KPENTER,KEY_KPPLUS,KEY_KPMINUS,KEY_KPASTERISK,KEY_KPSLASHPrintScreen→KEY_SYSRQ,ContextMenu→KEY_COMPOSE, plus navigation, lock and media keysWhen an event has no
code, it falls back tokeyfor modifiers, letters and digits.tests/svelte/keys.test.ts(new): readskeymap::NAMESfromcrates/voxctrl-hotkeys/src/win_keys.rsand checks that every name the recorder emits is in it. The Linux backends take their names from the evdev crate, which uses the same vocabulary. Also covers Shift and non-US layouts, AZERTY, right-side modifiers, NumLock-off keypad keys, and events with nocode. Cases are added towizard-data.test.tstoo.Load-time migration: new
voxctrl_config::migrate_legacy_key_name(s).raw_to_bindingrepairsbindings.tomlkeys in memory, and the next save writes the corrected names back.AppConfig::loadrepairstts.stop_keyand rewrites the config file. This replaces the separateKEY_ESCAPE→KEY_ESCmigration.KEY_./KEY_>→KEY_DOT, …),KEY_*,KEY_NUMPADENTER,KEY_PRINTSCREEN,KEY_CONTEXTMENU,KEYA…KEYZ, andKEY_ESCAPE.Updated the
win_keys.rsdoc comment, which described the old left-side folding.Notes and limits
KEY_Ö, are left as they are and have to be recorded again.KEY_1could be the top-row 1 or keypad 1, and is also a valid name in its own right, so an old keypad-digit binding stays on the top row.KEY_RIGHTCTRLwas never saved, so there is nothing to migrate for right-side modifiers.CTRL.trigger.rs) has no entries for keypad keys other than Enter, or forKEY_SYSRQ,KEY_COMPOSEandKEY_102ND. The recorder will reject those there. That limitation already existed and is left for a follow-up.Testing
npm run test:unit: 253 passednpm run check: 0 errors. The 453 warnings (Tailwind@apply) were already there.cargo test -p voxctrl-config -p voxctrl-hotkeys -p voxctrl-routing: all pass, including the new migration testscargo clippyon those three crates: no warnings on the new code🤖 Generated with Claude Code
https://claude.ai/code/session_01Nv8xwn4yhHm9dqmz6fuBtv
Generated by Claude Code