Problem
I have a non-qwerty keyboard layout (AZERTY, QWERTZ, Dvorak, etc.).
My keyboard shortcuts do not work out of the box, and I cannot type a special character with Shift getting some IDE action invoked instead.
Solution
At the moment there is no straightforward solution. One of the possible ways to solve the issue is to create an alternative keymap for each language and OS separately. We are currently investigating this matter and will post any updates to the dedicated ticket.
Quick workaround:
- Install the Keymap nationalizer plugin and turn on national keyboards support as follows:
- Go to the main menu
Help | Edit Custom VM Options... - Add the VM option, depending on your OS:
-
macOS/Linux: add the line
-Dcom.sun.awt.use.national.layouts=trueto enable the support or-Dcom.sun.awt.use.national.layouts=falseto disable it. -
Windows: add the line
-Dcom.sun.awt.useLatinNonAlphaNumKeycodes=trueto enable the support or-Dcom.sun.awt.useLatinNonAlphaNumKeycodes=falseto disable it.
- Restart the IDE
Additional information
TL;DR: Issues with national keyboard layouts might have different symptoms that can be divided into the following groups:
- Shortcuts invoke a wrong action: e.g. on an attempt to invoke
Cmd+\an action mapped toCmd+Shift+7gets invoked, orAlt+/results inAlt+Minus. - Special characters that require Shift to be pressed - e.g.
$,@,\- are recognized as a shortcut, so they can't be typed and invoke some IDE action instead.
Let's take a look at the IJ action Comment with Line Comment, it's bound to a shortcut Ctrl + / in the default IJ's keymaps (at least in Windows, macOS, GNOME and KDE ones). On the regular US keyboard layout both buttons are located on the first layout level, i.e. they don't require any modifier buttons (such as Shift, Alt and sometimes Ctrl+Alt/AltGr) to be pressed at the same time to be "reachable":
Just for example, this is not the case with the character $ on this layout - it's not reachable unless the modifier Shift is pressed, therefore, you have to press Shift + 4 to type it.
When we switch between keyboard layouts, the set of characters reachable on each level changes as well. There are usually 3-5 levels depending on a layout. Exactly this we observe when we switch from the regular US layout to the regular German layout (the scheme on the image is significantly simplified):
The character / disappears from the first layout level and only gets available on the second one - that is, it requires the Shift modifier to be pressed.
If a user presses the same physical buttons on the keyboard they used to press on the US layout to get Ctrl + /, the IDE will receive a Ctrl + - (Ctrl + Minus) keystroke and will not invoke the commenting action since Ctrl + - isn't equal to Ctrl + /. Also, some users think if they reach the / character on the German layout via the keystroke Shift + 7 and combine it with the Ctrl button, they'll get Ctrl + /, but instead IDEs receive Ctrl + Shift + 7 , which is bound to the action Toggle Bookmark with Digit. This is intended behavior, and, from what we know, more or less all applications handle it this way.
This problem in general is widespread among most - if not all - applications dealing with lots of keystrokes, and there's no common solution. Each affected application handles it this own way with varying degrees of success.
The problem gets worse when as a result of layout switching, shortcuts start conflicting with keystrokes used to input characters located on layout's higher levels (e.g. Alt + Shift + X close all my folder and goes to the root or On German Keyboard, shortcut for "Code" -> "Comment with Line Comment" doesn't work). The cause of such particular problems is that our keymaps were made not taking into account that some combinations of modifiers should never be used for shortcuts.
See also: How to enable national keyboard or DVORAK support in IntelliJ IDE
Comments
0 comments
Please sign in to leave a comment.