198

When I try to set the default combo for switching to different language layouts in my keyboard from Shift+Super+Space to Alt+Shift I can't.

I used to have this combo since Ubuntu 14 and even before that when I used to have Windows. Now for some stupid reason it does not allow (actually nothing happens its not like I get an error or the combo is used elsewhere). How could I bypass this bug?

2
  • 2
    Super+Space for switching input languages is the dumbest idea I have ever met on Ubuntu. In most of cases I end up with Search window over my workspace instead of other input language 😡 And even worth that Ctrl+Shift tweak breaks every shortcut in every application 👎
    – mevsme
    Jun 15, 2021 at 8:02
  • yeah, thanks to Super+Space - lost a fast access to "tab" part of the keyboard so probably Alt+shift is the best, maybe Ctrl+Shift is fine also. Hey, we have a thumb finger which is quite flexible, however our little finger is really little. When someone proposes me to press the smallest key (Super) with the smallest finger (little finger) where there are different way better solutions, total insanity ))) So obviously little finger is ideally fit to shift keyboard which is the largest (so far in my three keyboards) and the other key should be either alt or space. Nov 11, 2021 at 13:33

4 Answers 4

295

You may use (GNOME) Tweaks to achieve your goal. First install it by running

sudo apt install gnome-tweaks

(on Ubuntu 18.04 and later) or

sudo apt install gnome-tweak-tool

Launch Tweaks and go to Keyboard & Mouse section. Click on the "Additional Layout Options".

enter image description here

A new window should pop up. Look for "Switching to another layout" and expand it. Then check the "Alt+Shift" option.

enter image description here

23
  • 15
    What a mess.. and I am lucky since there are only hardcoded options and the one I want is in there.. :P I already miss unity ... Thanks m8! Also such a cute puppy! ^^
    – papajo
    Oct 22, 2017 at 12:58
  • 5
    Also it is well known bug 1218322. Only gnome-tweak-tool solve this problem.
    – N0rbert
    Oct 22, 2017 at 16:07
  • 1
    This does switch languages, but when I press Alt+Shift, Alt key press is handled by the active application. For example, it opens menu bar in Firefox. It makes switching languages very distracting every time. What am I doing wrong?
    – user502144
    Nov 20, 2017 at 18:49
  • 2
    @user502144 You're not doing anything wrong, that's a GNOME issue, it triggers on-press instead of on-release. See this for a not-so-elegant workaround: askubuntu.com/a/973906/480481
    – pomsky
    Nov 20, 2017 at 18:53
  • 3
    What I wanted was exactly the opposite - to free this key combination as it was messing up with my PHPStorm IDE's shortcuts, and the gnome tweak tool was the only way to do it (for me at least). This shortcut was enforced after an update which asked me if I wanted to enable this key combination... I don't remember clearly the type of the update. Even though I would like to have alt + shift for language switching, it does not behave exactly as the windows version and interferes with other short keys which use alt + shift, like for instance "alt + shift + up" in PHPStorm.
    – vivanov
    Aug 23, 2018 at 19:35
144

You can achieve this using gsettings (command-line configuration tool).

  1. Set forward switch to Shift+Alt(left)

    gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Shift>Alt_L']"
    
  2. Set backward switch to Alt+Shift(left)

    gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "['<Alt>Shift_L']"
    

To see the current setting value use get command:

gsettings get org.gnome.desktop.wm.keybindings switch-input-source
gsettings get org.gnome.desktop.wm.keybindings switch-input-source-backward

Examples of other key bindings:

<Primary>space, Alt_R, <Shift>Control_R, <Shift><Super>space

Changes will take effect immediately.

13
  • 15
    This is a nice way to achieve the desired change, but the instructions create a mapping that is unnatural for Windows users: you have to first press shift and then press Alt. To use the natural Windows sequence, change "['<Shift>Alt_L']" to "['<Alt>Shift_L']" and similarly for the backwards. Works just as it should. Apr 18, 2018 at 9:55
  • 4
    On ubuntu 19.10 this had the required effect, in contrary with gnome-tweaks which didn't seem to be working for alt+shift Feb 19, 2020 at 7:35
  • 2
    Works in Ubuntu 20.04 LTS. The accepted answer with Gnome Tweaks has a bug when Shift+Shift change keyboard as well gitlab.gnome.org/GNOME/gnome-tweaks/-/issues/145
    – Arxeiss
    Jun 1, 2020 at 9:00
  • 3
    Still cannot anwer with my low credits but it's: gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Alt>Shift_L', '<Alt>Shift_R', '<Shift>Alt_L', '<Shift>Alt_R']"
    – rubmz
    Nov 12, 2021 at 20:12
  • 3
    @rubmz: Thank you! I am running Ubuntu 22.04.1 LTS, and this solution is the only one that works. All others fail. Nov 26, 2022 at 12:38
11

Ubuntu 20.04, gnome flashback, the gsettings option didn't work for me. This fixed the problem (copied from my other machine):

gsettings set org.gnome.desktop.input-sources xkb-options "['grp:alt_shift_toggle', 'grp_led:scroll', 'lv3:switch']"

Keyboard shortcuts still show Super+Space combination, and it still works, but Alt+Shift works as well.

1
  • setting xkb-options allows layout switching without the window losing focus. I remember we used to do this using x11 configuration files. It is good to know that we can override it using gsettings.
    – pwned
    Feb 20, 2023 at 8:42
5

I am running Ubuntu 22.04; the problem exists here as well; all answers and suggestions fail here except @rubmz's comment above:

gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Alt>Shift_L', '<Alt>Shift_R', '<Shift>Alt_L', '<Shift>Alt_R']"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .