The problem is that Ubuntu (Linux in general) maps a lot of keyboard shortcuts.
Here is the list of keyboard shortcut doing problems but that I do need in IntelliJ:
- Ctrl+Alt+Left/Right : back in IntelliJ
- Ctrl+Alt+L : reformat code
- Alt+F7 : find usage
- Alt+F8 : evaluate expression
- Ctrl+Alt+S : settings dialog
- Alt+Mouse Button 1 : Block selection
- Ctrl+Shift+U : to uppercase
- Alt+F1 : select in
First if you are working in a virtual machine like VmWare
Ctrl+Alt+Left is most probably used to switch between vm. So is you are using VmWare navigate to and change the combination- VmWare: Edit->preferences->hot keys
Some of these can be changed in Ubuntu keyboard settings
For these I used to remove the settings in Ubuntu.
- Ctrl+Alt+L : settings->keyboard->shortcuts->system->lock screen
- Alt+F7 : settings->keyboard->shortcuts->windows->move window
- Alt+F8 : settings->keyboard->Windows->resize window
- Ctrl+Alt+S : settings->keyboad->windows-> toggle shade state
Some can be set at other places in the gui.
In the dconf editor:
- Alt+Mouse Button 1 /org/gnome/desktop/wm/preferences/mouse-button-modifier
You can't just disable the key, you must assign it to something fancy like Ctrl+Alt+Shift+Super+Escape
This one is still at another location
- Ctrl+Shift+U
- This option failed on Ubuntu 18.04. And I don't like it because, I don't know all the implications it has.
Go to Language Support on System Settings and change the Keyboard input method system to none => Then restart the system. (https://superuser.com/questions/358749/how-to-disable-ctrlshiftu-in-ubuntu-linux) - Adding the env variable
XMODIFIERS=""at intellij startup allows to use Ctrl+Shift+U
The var must be added in the ".desktop" file which starts IntelliJ. For snaps, it is located at: '/var/lib/snapd/desktop/applications' https://askubuntu.com/questions/1118729/disable-ctrl-shift-u-on-18-04-2-i-uninstalled-ibus-and-the-combo-still-works
The interesting part is that some of these can be changed on the console:
Changing keyboard shortcut from the command line
In order to have the complete list of shortcut available, try this command
gsettings list-recursively
Which gives us the following commands
- Ctrl+F8 : gsettings set org.gnome.desktop.wm.keybindings begin-resize "['disabled']"
- Ctrl+Alt+S : gsettings set org.gnome.desktop.wm.keybindings toggle-shaded "['disabled']"
- Ctrl+Alt+L: dconf write /org/gnome/desktop/screensaver/lock-enabled false
- Alt+Mouse Button 1: gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "['
Escape']"
- Ctrl+Alt+Right : gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "['disabled']"
- Ctrl+Alt+Left : gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "['disabled']"
Ansible
We can take this a step further and use ansible.By putting this script in a file: e..g, main.yml in ubuntu/tasks folder, with a hosts file containing
hosts file
[localhost]
localhost ansible_user=dev ansible_connection=local
playbook.yml file
- hosts: localhost
roles:
- intellij
- ubuntu
note that the initellij task do some additional configuration. like a quick list config etc.
Finally the following command should do the trick:
ansible-playbook -i hosts playbook.yml
- name: disable screen lock see http://xmodulo.com/control-screen-lock-settings-linux-desktop.html
command: dconf write /org/gnome/desktop/screensaver/lock-enabled false
tags: [ubuntu]
- name: disable mouse-button-modifier do not disable dconf Editor key /org/gnome/desktop/wm/preferences/mouse-button-modifier
command: gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "['
tags: [ubuntu]
- name: disable keyboard->Navigation->switch workspace org.gnome.desktop.wm.keybindings switch-to-workspace-right ['
command: gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "['disabled']"
tags: [ubuntu]
- name: disable keyboard->Navigation->switch workspace org.gnome.desktop.wm.keybindings switch-to-workspace-left ['
command: gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "['disabled']"
tags: [ubuntu]
- name: disable
command: gsettings set org.gnome.desktop.wm.keybindings begin-resize "['disabled']"
tags: [ubuntu]
- name: disable
command: gsettings set org.gnome.desktop.wm.keybindings toggle-shaded "['disabled']"
tags: [ubuntu]
Short cut to change in IntelliJ
- The Navigate -> Select in shortcut is normally mapped to Alt-F1 which I do not want to unmap in Ubuntu. So I add another shortcut in IntelliJ
File->Settings->Keymap->Main menu->Navigate->Select In
And I give the short cut: Ctrl-§
References
Alt+Left Button see http://askubuntu.com/questions/118151/how-do-i-disable-window-move-with-alt-left-mouse-button-in-gnome-shellI don't know how to deactivate Alt+F1 so I have to change the mapping in IntelliJ
check this post : http://askubuntu.com/questions/412046/unable-to-use-intellij-idea-keyboard-shortcuts-on-ubuntu