164

I am very new to Ubuntu, and I'm having a problem that I don't know how to get it fixed. I even tried looking it up on the web for answers, but maybe I don't know the right terms to search for it.

I work with IntelliJ IDEA, an application for development. And I am very used to the keyboard shortcuts, but when I made the switching from Windows XP to Ubuntu 13.10, some shortcuts don't work anymore. For example, such as;

  • Ctrl + Alt +
  • Alt + F8

Is there any reason as to why? and are there any fix for this? Or maybe just something to guide me on my searching

Thank you all very much in advance.

Catskul
  • 754
Rodrigo Sasaki
  • 2,059
  • 3
  • 17
  • 14
  • 1
    Are you referring to the Ubuntu shortcuts or the shortcuts within the running program. In you case, IntelliJ IDEA? – AzkerM Jan 28 '14 at 12:03
  • 2
    I'm referring to the Intellij IDEA shortcuts – Rodrigo Sasaki Jan 28 '14 at 12:04
  • You see, most of the shortcuts are pretty different between OS's but not the very common. As I can see shortcuts under keyboard (search from dash home), ALT+F8 refers to re-size window. – AzkerM Jan 28 '14 at 12:09
  • 1
    Is there anyway to make the application's shortcuts take precedent over the OS's ones? Or any other solution, I'd really like to get my shortcuts back – Rodrigo Sasaki Jan 28 '14 at 12:10
  • 8
    Ubuntu, please: user the super key for every system keyboard shortcut to differentiate them from regular user programs. – Ciro Santilli OurBigBook.com Feb 24 '16 at 16:01

13 Answers13

223

As a bit of reading taught me, Intellij IDEA is a keyboard-centric IDE. What it means is that a user can work with it without touching the mouse. Also, I've managed to find to keymap settings:

For Ubuntu

See How to change keyboard shortcuts?

Here’s a list of tweaks you need to make with default system key bindings so that they won’t interfere with IntelliJ IDEA actions (listed in brackets).

  • Disable the Shade window action, assigned to Ctrl + Alt + S (Settings dialog)
  • Change or disable the Lock Screen action, assigned to Ctrl + Alt + L (Reformat code)
  • Change or disable the Launch terminal action, assigned to Ctrl + Alt + T (Surround with)
  • Change or disable the Switch to workspace action, assigned to Ctrl + Alt + Arrow Keys (Navigation)
  • Disable the Move window action, assigned to Alt + F7 (Find usages)
  • Change or disable the Resize window action, assigned to Alt + F8 (Evaluate expression)

Hope this helps!

Note: You can always revert Ubuntu shortcuts back to its default state. Just refer to How can I restore default keyboard shortcuts?, in case if you're lost.

Source: -- Intellij IDEA Keymap

bruno
  • 105
AzkerM
  • 10,270
  • 6
  • 32
  • 51
  • You're saying I have to disable those actions on the OS so they won't overlap with the application's? – Rodrigo Sasaki Jan 28 '14 at 12:59
  • 3
    Exactly! As the points explains even on the official page. Some says disable and some points explains to change or disable by assuming that the user would use. For instance, user uses lock screen frequently, considering the fact; a user may change or disable according to their need. This make no harm but just disable/modify the shortcuts. :) – AzkerM Jan 28 '14 at 13:01
  • So simple :) Thank you for that! Thank you very much – Rodrigo Sasaki Jan 28 '14 at 13:24
  • I'm glad it helped you. :) – AzkerM Jan 28 '14 at 15:33
  • 6
    That's all well and good to tell us what keys need to be freed from their use in the OS. But you didn't tell us how to do that. – Lee Meador Oct 20 '14 at 18:53
  • 2
    @LeeMeador - OP's question was about keyboard shortcuts relating to IntelliJ IDEA. I've constructed the answer to fit OP's need. But, thanks for pointing out. I'll add that as well. (: – AzkerM Oct 21 '14 at 04:28
  • I added an answer for giving F7 it's freedom here: http://askubuntu.com/questions/515883/how-do-i-make-ctrlaltf7-keyboard-shortcut-work-in-intellij-on-ubuntu-14-04 – Lee Meador Oct 21 '14 at 15:15
  • 9
    To change keyboard shortcuts in Ubuntu go to Settings -> keyboard -> shortcuts. You'll have to navigate through the various windows to find where the shortcuts are set. – Dean Schulze Jan 19 '15 at 02:37
  • I use Alt-F1 quite a lot. But I don't want to unmap it from Ubuntu. So I mapped Alt-§, which in my keyboard is located at the top left. I.e., close to the original Alt-F1 – fan Mar 15 '17 at 09:57
  • I also unmapped the Alt Left-Button, for multiple select. It is used for dragging windows. See http://askubuntu.com/questions/118151/how-do-i-disable-window-move-with-alt-left-mouse-button-in-gnome-shell for a how to – fan Mar 15 '17 at 11:19
  • I disabled the shortcut, and now what? Intellij's navigate back functionality still doesn't work. – Coder-Man Sep 08 '18 at 23:24
  • 2
    Ctrl + Alt + Left or Ctrl + Alt + Right cannot be unassigned in Gnome GUI anymore :/ you need to use command-line version in another answer :/ – Tharok Dec 23 '18 at 21:48
39

I ran into this problem too, my solution, however, was different.

No hack or changing your systemwide keymap required

IntelliJ has different Keymaps, which you can change according to your OS.

You can change your IntelliJ Keymap from the settings.

Just go to Settings -> Keymap and select your desired keymap from the dropdown. In my case, I chose "Default for GNOME" since I am using Ubuntu Gnome 16.04.

  • 2
    Thanks a lot for sharing, this is a much better solution to the problem than changing your systemwide keymap. Might be problematic if you do a lot of OS/WM switching, though. – bfncs Jun 30 '16 at 15:06
  • I'm glad I was able to help. I agree, changing the systemwide keymap could cause problems. – Francisco C. Jul 02 '16 at 18:53
  • 3
    I did this, but there are certain shortcuts as Ctrl + Alt + Right which still belong to the keymap, even though it collapses with Ubuntu (when the "Enable working with desktops" option is enabled, it will change to the desktop on the right). Have any of you solved this? – jscherman Aug 26 '16 at 14:21
  • I haven't run into this problem, at least not that I can remember. I would look into it anyways and let you know. – Francisco C. Aug 29 '16 at 14:00
  • @jscherman - what keymap are you using? – Francisco C. Sep 17 '16 at 01:35
  • @FranciscoC. i'm using the one you mentioned: "Default for GNOME". But unfortunately there are still collisions as i said in my previous comment. I've already asked in the Jetbrains support and there they told me that there was an open feature request regarding to this already. So apparently i can't do anything but start disabling some Ubuntu's shortcuts – jscherman Oct 01 '16 at 18:03
  • @jscherman Unity apparently differs from Gnome in this regard. – Raphael Dec 21 '16 at 08:46
  • This is a solution to the problem but really unfortunate if you're coming to IntelliJ from a different platform like OSX. The GNOME and OSX keybinds could not be more different. Definitely a letdown from IntelliJ's side. – fIwJlxSzApHEZIl Aug 22 '17 at 16:59
  • This is a partial solution at best. Ctrl+Alt+S (open settings) still minimizes the windows. IntelliJ needs to come up with an alternative key mapping that works. – Dean Schulze Jan 17 '18 at 21:50
  • This did not work at all. – Coder-Man Sep 08 '18 at 23:25
  • @Coder-Man - what are you experiencing?

    Now that Gnome is Ubuntu's default DE, I would expect this to be a more viable solution.

    – Francisco C. Nov 10 '18 at 13:46
  • @FranciscoC. I've always used the Gnome Keymap and still many frequently used commands are intercepted by Gnome and mapped to window manager stuff – Shanteva Apr 20 '23 at 15:12
30

For ubuntu 18.04 LTS ctrl + alt + left (Intellij idea shortcut conflict)

  • install Dconf Editor in ubuntu software
  • launch Dconf Editor, go to /org/gnome/desktop/wm/keybindings/switch-to-workspace-left

  • double click like below

  • use default value (click Off) -> Custom value (like me or else)

  • you could use it in intellij idea now

enter image description here

Sebastian
  • 604
  • 1
  • 7
  • 15
think
  • 401
9

I have created this script that disables all clashing shortcuts between Ubuntu (tested with 15.10) and IntelliJ (and probably more Jetbrains products). It disables them in Ubuntu.

It also creates a backup file so that you can restore your previous settings.

To not have some shortcuts disabled, comment them out in the KEYS array.

#!/bin/bash
set -euo pipefail

# Disables Ubuntu shortcuts that clash with IntelliJ Idea (and probably other
# Jetbrain products).
#
# Creates a backup file to restore the previous settings. To not have some
# shortcuts disabled, comment them out in the `KEYS` array.
#
# Tested on : Ubuntu 15.10
# Author    : Jonas Gröger

readonly BACKUP_FILE="undo-fix-shortcuts-$(date +%s%N).sh"
readonly KEYS=(
    "/org/gnome/desktop/wm/keybindings/toggle-shaded"
    "/org/gnome/settings-daemon/plugins/media-keys/screensaver"
    "/org/gnome/settings-daemon/plugins/media-keys/terminal"
    "/org/gnome/desktop/wm/keybindings/switch-to-workspace-down"
    "/org/gnome/desktop/wm/keybindings/switch-to-workspace-up"
    "/org/gnome/desktop/wm/keybindings/switch-to-workspace-left"
    "/org/gnome/desktop/wm/keybindings/switch-to-workspace-right"
    "/org/gnome/desktop/wm/keybindings/begin-move"
    "/org/gnome/desktop/wm/keybindings/begin-resize"
    # To disable resetting a value, just comment out the line
)
readonly DISABLED_VALUE="['disabled']"

main() {
    # Make backup
    printf "#!/bin/bash\n" >>  "$BACKUP_FILE"
    for key in "${KEYS[@]}"; do
        local value
        value=$(dconf read "$key")
        printf "dconf write \"%s\" \"%s\"\n" "$key" "$value" >> "$BACKUP_FILE"
    done

    # Disable all Ubuntu shortcuts
    for key in "${KEYS[@]}"; do
        dconf write "$key" "$DISABLED_VALUE"
    done
}
main

You can get it from here:

wget -O fix-shortcuts.sh https://gist.githubusercontent.com/JonasGroeger/94cfa1071fa12572f465/raw/fix-shortcuts.sh
4

Additionally, I suggest to disable all shortcuts for workspaces (if you don't use it) via the following commands:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up []
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down []
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left []
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right []
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-right []
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-up []
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-left []
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-down []
kh0ma
  • 41
  • 1
4

See here for a way to disable Ubuntu shortcuts programmatically and only if windows of certain applications are active.

Specifically, use these values (assuminging you use the JetBrains Toolbox with its standard install path; adapt otherwise):

apppattern = "JetBrains"
backupfile = "~/.local/share/JetBrains/keymap_backup"

While the script runs, Ubuntu shortcuts will always work except when IDEA et al. have focus.

I have a collection of JetBrains-specific shortcuts here; input is appreciated.

Raphael
  • 1,982
2

Just to expand a little bit on AzkerM's excellent answer:

  • Disable the Move window action, assigned to Alt + F7 (Find usages)
    • from Settings --> Keyboard --> Shortcuts --> Windows --> Move Window
  • Change or disable the Resize window action, assigned to Alt + F8 (Evaluate expression)
    • from Settings --> Keyboard --> Shortcuts --> Windows --> Resize Window
WillC
  • 1,718
2

Just some quick workaround:
If you have a "Windows" key on your keyboard, you can just add it to the whole shortcut combination - it should work. For example:

  • Ctrl + Win + Alt + T (Surround with)
  • Win + Alt + F8 (Evaluate expression)
guzoff
  • 121
1

I am running Ubuntu 16.04 and what was happening is when I used these key strokes (ctrl-alt-left/right), the window was resizing and placing itself to the right or left of my screen. I tried disabling these key bindings in: Settings/Keyboard/Navigation, even though I don't have workspaces enabled. It still didn't prevent the behavior I was seeing.

Fortunately, I opened up Compiz and stumbled across the Window Management/Grid plugin that was mapping these keys to place windows in a grid position. I disabled this plugin and now my IntelliJ key shortcuts work fine with ctrl-alt-left/right.

0

I use Xneur to switch mistyped text to other language. My system langauge is chaged by Ctrl + Shift what blocks Intellij hotkeys like Ctrl + Shift + F (Global search) and Ctrl + Shift + C (Comment). So left shift is ignored.

  • One solution is to change language using Ctrl_L + Shift_L and use Ctrl_R + Shift_R for Intellij. But it is some kind of discomfort.

  • The other solution is to use Xneur (sudo ap-get install xneur) to retype mistyped text in other language. You can disable any system langauge switching and assign it to xneur hotkeys (the same Ctrl+Shift). Xneur can be added to autostarted apps.

Zon
  • 214
0

In addition to changing the system key bindings as suggested by the accepted answer or to changing the IDEA key map, I suggest to also check any running applications if their key maps do not clash with IDEA.

In my case in was Clipit and its Ctrl + Alt + P and Ctrl + Alt + O.

Check out this answer for more extensive tutorial on how to find conflicting apps.

0

I had this problem after configuring some keymaps for my i3wm on Ubuntu.

To make work againg, on Gnome, I did:

  • Open GNOME Tweaks (Install it, if you don't have)
  • Go to Keyboard & Mouse
  • Click in button "Aditional Layout Options"
  • I Removed aditional configs. In my case was "Switching to another layout" and "Alt + Shift".

After that my Webstorm was able to get all my "alt + shift" keymaps.

0

For Ubuntu 16.04 go to settings > Keyboard and find the particular combination conflicting with your desired out click on it and update the combination to a new one.