Skip to content

Name Print Screen, Menu and media keys as the backends do; repair more legacy key names - #159

Merged
JRufer merged 1 commit into
masterfrom
claude/ecstatic-curie-azrhcw
Sep 27, 2026
Merged

JRufer merged 1 commit into
masterfrom
claude/ecstatic-curie-azrhcw

Conversation

@JRufer

@JRufer JRufer commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Follow-up to #157. It brings over the parts of the closed #158 that #157 didn't cover.

Problem

  • Some keys are still saved under names no backend reports. The recorder names any key it has no rule for after its DOM code:

    • Print Screen is saved as KEY_PRINTSCREEN;
    • the Menu key as KEY_CONTEXTMENU;
    • Mute as KEY_AUDIOVOLUMEMUTE, and likewise for the other media keys.

    The backends report KEY_SYSRQ, KEY_COMPOSE, KEY_MUTE and so on, and the key matcher compares names exactly, so these shortcuts never fire.

  • TTS stop keys saved before v0.7.1 can still be broken. The old TTS stop-key recorder saved letters without the underscore (KEYV). Code review: fix TTS response-pipe bug, dedupe transcription finishing, trim hot-path I/O #157 fixed the recorder but did not repair stop keys already saved that way.

Changes

  • src/lib/keys.ts: maps PrintScreen → KEY_SYSRQ, ContextMenu → KEY_COMPOSE, and the seven media keys to their evdev names. The wizard gets keycap labels for these (PrtSc, Menu, Mute, Vol +, …).

  • Load-time repair (canonical_key_name): now also repairs:

    • the DOM names above;
    • KEY_NUMPADENTER → KEY_KPENTER;
    • KEYA…KEYZ → KEY_A…KEY_Z.

    This applies to both the TTS stop key and bindings.toml.

  • Deliberately not repaired: KEY_*, which could be the keypad * or Shift+8. The repair Record punctuation, keypad and right-side modifier keys under evdev names #158 made could move a binding to the wrong key.

  • Portal (trigger.rs): every key in keymap::NAMES now has a keysym. The new ones are:

    • Print, Menu, Pause, Num Lock and Scroll Lock;
    • the ISO key beside left Shift (less);
    • the XF86 media keys.

    Before this, the portal refused shortcuts that used these keys.

Tests

  • tests/svelte/keys.test.ts (new): reads keymap::NAMES from win_keys.rs and checks that every key name the recorder can produce is in it. KEY_KPEQUAL is the one allowed exception: it is a valid Linux name with no Windows scan code. I checked that this test fails on the old mapping (it reports KEY_PRINTSCREEN and KEY_AUDIOVOLUMEMUTE).
  • Keycaps: every mapped key must have a readable keycap label.
  • Portal (trigger.rs): every name in keymap::NAMES must translate to a keysym.
  • Migration: covers the new repairs, and checks that real names (KEY_A, KEY_KP1, KEYBOARD) and the ambiguous KEY_* are left alone.

Verification

  • cargo test passes for voxctrl-config, voxctrl-hotkeys and voxctrl-routing.
  • cargo clippy --all-targets on those crates reports no warnings.
  • svelte-check reports 0 errors and 0 warnings.
  • vitest passes 264/264.
  • dist/ is rebuilt.

🤖 Generated with Claude Code

https://claude.ai/code/session_015v84hAqhDBdwy7Q49gAWBR


Generated by Claude Code

…e legacy names

The recorders named any key without a rule after its DOM code, so Print
Screen was saved as KEY_PRINTSCREEN, the Menu key as KEY_CONTEXTMENU and
Mute as KEY_AUDIOVOLUMEMUTE. No backend reports those names, so such a
shortcut could never fire. They now map to KEY_SYSRQ, KEY_COMPOSE and the
evdev media names, with readable keycap labels.

Loading now also repairs those DOM names, KEY_NUMPADENTER, and letters the
old TTS stop key recorder saved without the underscore (KEYV -> KEY_V), in
both the stop key and bindings.toml. KEY_* stays as it is: it could be the
keypad * or Shift+8.

The portal translates every key in keymap::NAMES now (Print, Menu, Pause,
Num/Scroll Lock, the ISO 102nd key and the media keys), and two new tests
keep the three sides in step: the recorder's output is checked against
keymap::NAMES, and every name there must have a portal keysym.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015v84hAqhDBdwy7Q49gAWBR
@JRufer
JRufer marked this pull request as ready for review September 27, 2026 01:16
@JRufer
JRufer merged commit fbb1fe5 into master Sep 27, 2026
5 checks passed
@JRufer
JRufer deleted the claude/ecstatic-curie-azrhcw branch September 27, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants