On Windows EN-US 101 key layout the right Alt key (AltGr on UK keyboards) works the same as the left Alt key. For EN-GB and all other layouts it registers as Control + Alt.
We can fix the above behaviour on non-US key layouts; when either the Alt or AltGr modifier is used:
the globalShortcut of Control + Alt + {shortcutKey} should be registered, which will ensure that the right alt key works
the globalShortcut of Alt + {shortcutKey} should be registered, which will ensure that the left alt key also works
This is also an issue on Linux, the solution there is to register the (undocumented) accelerator AltRight (instead of Control + Alt above)
The KeyboardLayoutMap can be used to determine if the EN-US layout is being used, as it is the only layout where Backslash maps to \.
On Windows EN-US 101 key layout the right Alt key (AltGr on UK keyboards) works the same as the left Alt key. For EN-GB and all other layouts it registers as
Control + Alt
.We can fix the above behaviour on non-US key layouts; when either the
Alt
orAltGr
modifier is used:Control + Alt + {shortcutKey}
should be registered, which will ensure that the right alt key worksAlt + {shortcutKey}
should be registered, which will ensure that the left alt key also worksThis is also an issue on Linux, the solution there is to register the (undocumented) accelerator
AltRight
(instead ofControl + Alt
above)The KeyboardLayoutMap can be used to determine if the EN-US layout is being used, as it is the only layout where
Backslash
maps to\
.https://www.w3.org/TR/uievents-code/#keyboard-101 Related Electron issue: https://github.com/electron/electron/issues/13895