55

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.

pomsky
  • 70,557
MrMamen
  • 653

3 Answers3

69

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.

pomsky
  • 70,557
31

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.

slava
  • 4,085
wisbucky
  • 2,762
  • 32
  • 17
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.

vvetrov
  • 21