Godot Version
4.4.1
Question
I’m working on a custom keyboard remapping UI and ran into something odd regarding physical vs logical keycodes.
According to the documentation, the recommended way to get a human-readable name for a physical key is:
var logical := DisplayServer.keyboard_get_keycode_from_physical(ev.physical_keycode)
var name := OS.get_keycode_string(logical)
However, for certain keys (notably punctuation like [ ] etc.), this produces names such as "BraceLeft" or "BraceRight" instead of the expected "BracketLeft" / "BracketRight".
Example (printing both values):
Physical code: 91 Logical code: 123
Physical code: 93 Logical code: 125
OS.get_keycode_string(123) returns "BraceLeft", but visually this key is the [ key on a US QWERTY keyboard.
If I skip the physical→logical conversion and call:
var name := OS.get_keycode_string(ev.physical_keycode)
I get correct and expected names, e.g:
“BracketLeft”
“BracketRight”
Why does the documentation recommend converting physical → logical → string, when using the physical keycode directly produces more correct/expected names for physical-key remapping?
Is this intended behavior?