46

In Ubuntu 18.04 I'm not able to assign Ctrl+Alt+ or Ctrl+Alt+ to anything. To be precise I may bind it to something, but it doesn't work when using the keyboard combination, up/down arrows do however work.

See screenshot here.

The strange thing is that the system detects the keyboard combinations when assigning a key, but not when trying to use them. As a result the keyboard combinations don't work in any other programs either.

1

3 Answers 3

53

Ctrl+Alt+ and Ctrl+Alt+ are default shortcuts for "switch to workspace left" and "switch to workspace right" respectively. You can verify that by running

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

(and right in place of left).

Since by default GNOME shell has single column workspaces these shortcuts show no effects at all (unless you try something like this).

To unbind these keyboard combinations, run

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

(similarly for right). Then you'll be able to use these combinations for your custom shortcuts.

5
  • Very interesting that it still shows up when i try "get" on these, even though I have removed them from keyboard settings i GUI. However settting doesn't seem to work: ➜ ~ gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left [] zsh: no matches found: [] ➜ ~ gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left [''] zsh: no matches found: []
    – MrMamen
    Jun 1, 2018 at 13:08
  • 2
    Worked when using quotes around the brackets, like: gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"
    – MrMamen
    Jun 1, 2018 at 13:14
  • @MrMamen Thanks for the info, I edited the answer.
    – pomsky
    Jun 1, 2018 at 13:16
  • great! It solves the Fedora30 issue. The Fedora30 setting UI miss this keymap
    – Xin Meng
    Aug 27, 2019 at 14:05
  • 1
    thanks, fixed my vscode shortcuts Apr 28, 2021 at 14:47
25

The problem is that the Ubuntu 18.04 Settings GUI doesn't show all the keyboard shortcuts.

  • It doesn't list "Move (Switch) to workspace to the left/right" (even though there is a shortcut assigned).
  • It only shows the first keyboard shortcut if there are multiple shortcuts for a command, like for "Move (Switch) to workspace above/below", which actually has a second keybinding for Ctrl+Alt+up/down.

enter image description here

To see all of the window manager keybindings:

gsettings list-recursively | grep org.gnome.desktop.wm.keybindings | sort

org.gnome.desktop.wm.keybindings switch-to-workspace-down ['<Super>Page_Down', '<Control><Alt>Down']
org.gnome.desktop.wm.keybindings switch-to-workspace-left ['<Control><Alt>Left']
org.gnome.desktop.wm.keybindings switch-to-workspace-right ['<Control><Alt>Right']
org.gnome.desktop.wm.keybindings switch-to-workspace-up ['<Super>Page_Up', '<Control><Alt>Up']

Now, you can see that there are a bunch of Ctrl+Alt+up/down/left/right keybindings that weren't shown in the Settings screen.

To remove the unwanted keybindings:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "['<Super>Page_Down']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "['<Super>Page_Up']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"

Now you can use keybindings in other places.

1
  • 3
    Another shortcuts you would remove are, Ctrl+Shift+Alt+ left, move windows to the left workspace, gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-left "[]", and similar Ctrl+Shift+Alt+right, move window to the right workspace, <br>gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-right "[]" Apr 5, 2019 at 4:31
2

It looks like the above answers will not help.

For me in Ubuntu 20.04 i have modified /usr/share/X11/xkb/symbols/group file (via sudo) and commented these lines (marked bold):

// CTRL-SHIFT toggle section
//
//partial modifier_keys
//xkb_symbols "lctrl_lshift_toggle" {
//    key <LFSH> {
//        type[Group1]="PC_CONTROL_LEVEL2",
//        symbols[Group1] = [ Shift_L, ISO_Next_Group ]
//    };
//    key <LCTL> { [ Control_L, ISO_Next_Group ] };
//};
//partial modifier_keys
//xkb_symbols "lctrl_lshift_toggle_rev" {
//    key <LFSH> {
//        type[Group1]="PC_CONTROL_LEVEL2",
//        symbols[Group1] = [ Shift_L, ISO_Prev_Group ]
//    };
//    key <LCTL> { [ Control_L, ISO_Prev_Group ] };
//};
partial modifier_keys
xkb_symbols "rctrl_rshift_toggle" {
    key <RTSH> {
        type[Group1]="PC_CONTROL_LEVEL2",
        symbols[Group1] = [ Shift_R, ISO_Next_Group ]
    };
    key <RCTL> { [ Control_R, ISO_Next_Group ] };
};
partial modifier_keys
xkb_symbols "ctrl_shift_toggle" {
//    include "group(lctrl_lshift_toggle)"
    include "group(rctrl_rshift_toggle)"
};
partial modifier_keys
xkb_symbols "ctrl_shift_toggle_bidir" {
//    include "group(lctrl_lshift_toggle_rev)"
    include "group(rctrl_rshift_toggle)"

Then logged out and logged in again. And it helped.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.