Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing keyboard shortcut conflicts between IDE and OS (Ubuntu)

I'm using IntelliJ IDEA, but I think this applies to any IDE.

In IDEA, some very useful keyboard shortcuts conflict with Ubuntu keyboard shortcuts. Some examples:

  • Ctrl+Alt+L : formats the source code (mapped to "Lock Screen" in Ubuntu)
  • Ctrl+Alt+Left : navigates backward (mapped to "switch to workspace on the left of the current workspace" in Ubuntu)
  • ...

I've been using Ubuntu for a long time, and I'm used to these shortcuts. I use them all the time to switch between workspaces, lock my session... At the same time, I know how useful the IntelliJ shortcuts can be, and I want to avoid using the mouse as much as possible.

Currently, my workaround for "format source code" is Alt+D (opens the "Code" menu), followed by "R" ("Reformat Code"). It works okay, since I don't format code that often, but it could be better. There is no real alternative for Ctrl+Alt+Left, though.

How do you manage these conflicts in your IDE?

Do you simply remap all the conflicting IDE keyboard shortcuts to something else (and then get lost when you are pair programming with a colleague with different shortcuts...)?

Do you remap the Linux keyboard shortcuts (even though you are "used" to them)?

Is there a way to make keyboard shortcuts "contextual"? By this, I mean: hit a key to go into "IDEA mode" when coding (all conflicting Ubuntu shortcuts are temporarily deactivated), hit the key again to go back to "Standard mode" (Ubuntu shortcuts are reactived).

Do you have any other ideas / tips on how to manage this problem?

like image 772
Etienne Neveu Avatar asked Apr 04 '11 09:04

Etienne Neveu


3 Answers

I use Ubuntu as well and I disabled the native (Ubuntu) command Ctrl + Alt + L because I prefer IntelliJ's format code than this native Ubuntu command. However, in the 2nd case I prefered Ubuntu's shortcut so I didn't change anything.

So basically, you can choose which option you need more and then act accordingly.

Of course, until IDEA becomes Ubuntu friendly.

In the end, Ubuntu will always prefer its shortcuts and so far I haven't found any tool that can disable native shortcuts on request.

like image 50
sandalone Avatar answered Nov 11 '22 02:11

sandalone


I changed ubuntu shortcuts to

  • ctrl+win+L
  • ctrl+win+Left

similar to original. Works fine for me.

like image 24
fantom Avatar answered Nov 11 '22 01:11

fantom


In Ubuntu, the way to disable the ctrl+alt+left keybinding is to open System Settings -> Keyboard -> Shorcuts(tab) -> Navigation . Scroll to "Switch to workspace left", click on it and hit Backspace. It is silly that this is even enabled for stock Ubuntu 14.04 where there is only one desktop by default.

like image 33
postfuturist Avatar answered Nov 11 '22 02:11

postfuturist