Skip to content

Support hotkey re-registration on keyboard key code changes#108

Merged
Econa77 merged 3 commits into
masterfrom
feature/hotkey-layout-reregistration
May 9, 2026
Merged

Support hotkey re-registration on keyboard key code changes#108
Econa77 merged 3 commits into
masterfrom
feature/hotkey-layout-reregistration

Conversation

@Econa77

@Econa77 Econa77 commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

  • add an opt-in autoReRegisterOnKeyboardKeyCodesChange flag to HotKey
  • observe NSNotification.Name.SauceSelectedKeyboardKeyCodesChanged and re-register only enabled hot keys whose stored key code no longer matches the current input source
  • keep the QWERTY and Dvorak example in the API documentation so the reason for the option is explicit
  • enable the option in the example app for the sample hot key

Why

macOS registers the layout-specific key code that is current at registration time. For example, registering v uses KeyCode 9 on a QWERTY layout, but KeyCode 47 on a Dvorak layout. If the selected keyboard key codes change later, the registered hot key can stop pointing at the intended physical key unless it is registered again.

Impact

Existing behavior is unchanged by default. Callers can opt in per hot key when they want automatic re-registration on keyboard key code changes.

Validation

  • swift test

@Econa77 Econa77 changed the title Support hotkey re-registration on keyboard layout changes Support hotkey re-registration on keyboard key code changes May 8, 2026
@Econa77 Econa77 marked this pull request as ready for review May 8, 2026 06:50
@Econa77 Econa77 merged commit c23c350 into master May 9, 2026
14 checks passed
@Econa77 Econa77 deleted the feature/hotkey-layout-reregistration branch May 9, 2026 03:36
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.

1 participant