How to context-menu with ZSA Moonlander in IntelliJ IDEA


Posted by Steven

Recently, I bought a Moonlander keyboard. Since then, I'm trying to learn how to type again. :D Although I had a rough time working with the new ortholinear setup and also defining "my" layout with the awesome software oryx, it's a blast. If you are typing professionally, for example as a programmer or writer, do yourself a favor and buy some professional gear like this keyboard.

However, you will run into unexpected problems because you have to relearn the whole typing experience you are used to. This includes issues like the one I solved today: How to right click and access the context menu of the current selection in IntelliJ IDEA. Note that this is different to the normal right click which creates the context menu at the current position of the mouse cursor! Creating the menu at the currently focused location can be used to perform actions without touching the mouse. For example, I use it in the structure view of IDEA. I don't want to move the mouse to this view. Instead, I just want to select something by using only the keyboard by pressing Alt + 1 to get to the structure view and then using the arrow keys to navigate. Now, I can select a package and trigger the context menu on that package to create a new class within that package. My mouse may reside somewhere at the edge of the screen. This workflow worked like a charm with my laptop keyboard and my old external keyboard because both of them had the context menu button:

Google reveals that this button is a shortcut for Shift + F10. However, in IDEA, this is already used for running the current run configuration. This configuration has to be deleted in order to use it for the context menu.

This Stackoverflow article reveals that the correct naming for the shortcut in IDEA's keymap is "Show context menu". With that, you can make IDEA open the context menu under the current selection with Shift + F10, as in Windows.

In my moonlander layout, I set this key to the right thumb cluster. That way, I can use the left thumb cluster for the usual right and left clicks and the right thumb cluster for the right click on current selection. With the setup given in this article, this works both in Windows as well as in IDEA.

 

UPDATE

A coworker found a better solution. There's an actual key called "Application" that not only produces the same result as my solution in this article, but also displays the usual icon:

Category: 
Share: