Samy
Samy

Reputation: 2497

IntelliJ Idea Ctrl+Alt+Left shortcut doesn't work in Ubuntu

I am using IntelliJ Idea 2017.3 latest release in Ubuntu 2017.10 and shortcut Ctrl+Alt+Left/Right doesn't work.

Whereas from menu Navigate -> Back/Forward works fine.

Reference : https://www.jetbrains.com/help/idea/navigation-in-source-code.html

Upvotes: 181

Views: 43149

Answers (18)

Rogério Ramos
Rogério Ramos

Reputation: 99

Just for others that might not find their solutions here, I had a similar issue on my Archlinux/Gnome3

In my case it was not a workspace naviagation taking precedence over IntelliJ but a hidden shortcut only visualized and fixed via gsettings get/set

Here I describe how I found and fix it

Upvotes: 0

Ubuntu binds this key combination to Switch Workspace. Starting from Ubuntu 18.04, you need to use the command line to change the shortcut (source), because the Ubuntu Keyboard Settings GUI might not show this option. Simply removing all shortcuts for that action is the easiest way to allow IntelliJ to use them:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"

However, as user @stackunderflow writes, "there is no need to remove all gnome key bindings for switch-to-workspace-left and switch-to-workspace-right". If you want to keep the non-conflicting ones, see their answer.

In any case, if you ever want to restore the shortcuts, use:

gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-left
gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-right

Default keymap

In addition, your IntelliJ installation might be set to the the default for GNOME keymap instead of the one you're used to. This maps the Navigate - Forward and Navigate - Backward shortcuts to Ctrl + Alt + Windows Key + Left/Right. Under File > Settings > Keymap, you can either modify the key combination for just those shortcuts, or switch to the default keymap entirely.

Upvotes: 321

stackunderflow
stackunderflow

Reputation: 436

There is no need to remove all gnome key bindings for switch-to-workspace-left and switch-to-workspace-right (as some other answers suggested). Just remove the conflicting bindings.

First check which keys are currently assigned:

gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-left
gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-right

You may see

['<Super>Page_Up', '<Super><Alt>Left', '<Control><Alt>Left']
['<Super>Page_Down', '<Super><Alt>Right', '<Control><Alt>Right']

And then set the new bindings, but omit the conflict keys, e.g:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "['<Super>Page_Up', '<Super><Alt>Left']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "['<Super>Page_Down', '<Super><Alt>Right']"

Alternatively, if you don't mind using Alt-Shift instead of Alt-Ctrl, go with frank's solution.

Upvotes: 2

Akhilesh Joshi
Akhilesh Joshi

Reputation: 362

For me, this worked in Intellij IDE ( ubuntu )

File -> Settings -> Keymap --> change GNOME to Windows

After this change, I am able to navigate with ALT and left/right key

Upvotes: 0

Adenir Rodrigues
Adenir Rodrigues

Reputation: 1

for me was needed first:

sudo apt install gnome-tweak-tool

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"

Upvotes: 0

Mixaz
Mixaz

Reputation: 4178

Not exactly the original issue, but I'm leaving it as an answer here since this question pops up in google search results - in my case Android Studio 2020.3.1 on ArchLinux Gnome (with Gnome keymap in AS settings) Alt+Shift+Left/Right do not work because the are already assigned (what?!) on other actions.

Going to File / Settings / Keymap / Main Menu / Navigate / Back then Add Keyboard shortcut shows a warning Already assigned to: Select Previous Tab in multi-editor file and Accept Rigth Side in VCS - right, already 2 other assignments. Since it got broken after some AS update, I believe it was a bug (hopefully fixed) in default AS keymap for Gnome.

So I have to remove that conflict to get keys working.

Upvotes: 0

Konstantin Pelepelin
Konstantin Pelepelin

Reputation: 1563

In LUbuntu 20.04 the offendig settings were found in .config/openbox/lxqt-rc.xml. They are expected to be editable by lxqt-config-globalkeyshortcuts app (Preferences -> LXQt settings -> Shortcut keys), but are not shown in the app.

Ref: https://manual.lubuntu.me/stable/3/3.2/3.2.14/shortcut_keys.html

gsettings and dconf appear unrelated

Upvotes: 0

John
John

Reputation: 336

For Linux Mint Cinnamon, the default workspace switching keybinding that interferes with IntelliJ keybinding can be changed with the following :

Disable:

gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-left "@as []"
gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-right "@as []"

Reset to defaults:

gsettings reset org.cinnamon.desktop.keybindings.wm switch-to-workspace-left
gsettings reset org.cinnamon.desktop.keybindings.wm switch-to-workspace-right

Thanks @László for the Ubuntu Gnome hint.

Upvotes: 3

Jess
Jess

Reputation: 3715

In my case:

  1. Click the keyboard on the right of UI ==> Input Method Configuration will appear. enter image description here
  2. Click Global Config and then Show Advanced Options.
  3. Remove Hotkey Saving All Confg and Input History.

Upvotes: 1

London Smith
London Smith

Reputation: 1659

My Gnome was configured to CTRL+ALT+left or right and I don't why but it moved to CTRL+ALT+Up or down. Workspaces were aligned horizontally and they changed to be vertical. I don't what I did to get this! Maybe the same thing happened to you...

I am fine with that, it changes a lit bit my desktop, changes are good some times...

I advice you to install the extension Workspace to dock which is very cool ;)

enter image description here

Upvotes: 0

asu
asu

Reputation: 95

Ctrl + Windows + Left/Right ; Ubuntu 20.04, IDEA: 2020.1, works for me

Upvotes: 0

Rakesh Paruchuri
Rakesh Paruchuri

Reputation: 187

In Ubuntu System settings you have to either desible shortcut for Ctrl+Alt+Left/Right or use Ctrl + Windows Key + Alt + Left/Right

Upvotes: 9

kuceraf
kuceraf

Reputation: 601

The right setting is combinations of already posted answers. To sum up:

1. Remove key bindings of Ctrl+Alt+Right/Left to GNOME enviroment

In terminal run:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"

2. Assigne the bindings to Forward / Back actions in Idea IntelliJ

If you use Keymap setting based on GNOME keymap the defaults for Forward / Back actions are not Ctrl+Alt+Right/Left. It must be setted.

In Idea IntelliJ menu

File | Settings | Keymap 

search for

Main menu - Navigate - Forward

click on edit shortcuts and set it to Ctrl+Alt+Right

then search for

Main menu - Navigate - Back

click on edit shortcuts and set it to Ctrl+Alt+Left

Works on versions: Ubuntu 18.04.3 LTS Idea IntelliJ 2019.2.3

Upvotes: 24

Jazzepi
Jazzepi

Reputation: 5480

The solution by @lászló-van-den-hoek here was correct, but I had to take one more step.

Go to File | Settings | Keymap in Intellij and change the Keymap from Default for GNOME to Default.

I think this has been tripping people up since Ubuntu switched from Unity desktop to a GNOME based desktop, and now Intellij is starting up with GNOME appropriate hotkeys.

Upvotes: 4

Ayodele Noutouglo
Ayodele Noutouglo

Reputation: 121

Ctrl + Windows Key + Alt + Left/Right worked on my Linux Fedora 22.

Upvotes: 9

VIVEK CHOUDHARY
VIVEK CHOUDHARY

Reputation: 546

I'm using ubuntu 16.04 LTS.

  1. Go to System Settings -> Text Entry -> Keyboard Settings (bottom right of the screen).

  2. On the keyboard dialog, click on Navigation tab. Then scroll down to "switch to workspace left" and select it and click backspace to disable it.

Your android studio shortcut should work now.

Upvotes: 7

frank
frank

Reputation: 671

I just found out that my IDEA 2018.3 in Ubuntu 18.04 automatically uses default for GNOME keymap, and the Back/Forward shotcut turns out to be Alt + Shift + Left/Right, no need to change any system settings.

Upvotes: 57

Samy
Samy

Reputation: 2497

Ubuntu has a shortcut Ctrl+Alt+Left/Right to navigate between workspaces. When i changed it under system settings, IDE is able to pick up the shortcut.

Upvotes: 12

Related Questions