Skip to content

feat: opt-in Windows layout-aware shortcut chords - #269

Open
Guffawaffle wants to merge 6 commits into
STFC-Mod:devfrom
Guffawaffle:feature/layout-aware-letter-shortcuts
Open

Guffawaffle wants to merge 6 commits into
STFC-Mod:devfrom
Guffawaffle:feature/layout-aware-letter-shortcuts

Conversation

@Guffawaffle

@Guffawaffle Guffawaffle commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds opt-in Windows keyboard-layout-aware shortcuts. Letters and punctuation follow the active layout, including the Shift needed to type a character—for example, / uses Shift+7 on German keyboards.

[control]
keyboard_layout_mode = "layout"

Physical mode remains the default. Restart after changing the setting; subsequent keyboard-layout changes apply live. Displayed bindings retain their configured TOML text.

Mappings refresh through device notifications, without polling. Held keys are suppressed during transitions, and unresolved characters are disabled individually. Characters requiring inferred Ctrl/Alt/AltGr are unsupported.

Windows x64 only. Selecting layout mode on macOS disables printable bindings; use physical mode there. Layout-required modifiers can make existing bindings overlap; see layout behavior and configuration.

@netniV netniV left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like overkill. If the unity engine is capable of working both ways, we should be simply following what the game currently does. If we should override that, it is surely as simple as updating which mode it's operating in?

Additionally, we are resolving shortcuts during a keyframe in the key functions adding overhead.

Keyboard layouts change by nationality in more ways than just the alphabetic keys.

@netniV

netniV commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

@Guffawaffle

Copy link
Copy Markdown
Contributor Author

Ooo, I'll dig into this—thanks for the pointer! You're right, I should keep it slimmer, as always 😄

This already uses Unity's FindKeyOnCurrentKeyboardLayout to bridge layout-aware letters into our existing KeyCode polling, so configured Z follows the active layout. But the docs point to a cleaner change-notification approach that could move the layout checks out of the shortcut-query path. I'll investigate that, along with whether there's a simpler mode-setting option available to us.

A–Z was deliberately the first slice, but fair point that layouts differ beyond letters too. I'll keep that distinction explicit while slimming this down.

@Guffawaffle
Guffawaffle marked this pull request as draft September 7, 2026 00:32
@Guffawaffle Guffawaffle changed the title feat: opt-in layout-aware letter shortcuts feat: opt-in layout-aware shortcut keys Sep 7, 2026
Comment thread tests/shortcut_hint_cache.cc Outdated
Comment thread tests/shortcut_hint_cache.cc
@Guffawaffle
Guffawaffle marked this pull request as ready for review September 7, 2026 07:53
@Guffawaffle
Guffawaffle marked this pull request as draft September 8, 2026 02:25
@Guffawaffle
Guffawaffle force-pushed the feature/layout-aware-letter-shortcuts branch from 3b229c6 to e8a4883 Compare September 10, 2026 03:58
@Guffawaffle Guffawaffle changed the title feat: opt-in layout-aware shortcut keys feat: opt-in Windows layout-aware shortcut chords Sep 10, 2026
@Guffawaffle
Guffawaffle marked this pull request as ready for review September 11, 2026 20:54
@Guffawaffle

Copy link
Copy Markdown
Contributor Author

This has been confirmed functional by the requesting user.

# Conflicts:
#	mods/src/patches/mapkey.cc
#	tests/shortcut_hint_cache.cc
#	xmake.lua
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