Ubuntu 17.10 and later: can't change the input switching shortcut to alt+shift

109,049

Solution 1

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

Solution 2

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.

Solution 3

Ubuntu 20.20, 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.

Share:
109,049

Related videos on Youtube

papajo
Author by

papajo

Updated on September 18, 2022

Comments

  • papajo
    papajo over 1 year

    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?

    • mevsme
      mevsme almost 3 years
      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 👎
    • Nusrat Nuriyev
      Nusrat Nuriyev over 2 years
      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.
  • papajo
    papajo over 6 years
    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! ^^
  • N0rbert
    N0rbert over 6 years
    Also it is well known bug 1218322. Only gnome-tweak-tool solve this problem.
  • pomsky
    pomsky over 6 years
    @N0rbert Are you sure Tweaks is the only way? Not possible with dconf/gsettings?
  • N0rbert
    N0rbert over 6 years
    By 'only' I mean GUI for average and newbie users. Setting it from dconf/gsettings may be possible too.
  • user502144
    user502144 over 6 years
    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?
  • pomsky
    pomsky over 6 years
    @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
  • voithos
    voithos over 6 years
    What about switching to the previous input source? Is that possible to set as, say, "Ctrl + Alt + Shift"? Having to cycle through them all becomes a bit annoying with 3 or more sources.
  • Ivan Klass
    Ivan Klass over 6 years
    Thank you very much - that helped me to disable Alt-Shift (it broke other application hotkeys)
  • Tony Bogdanov
    Tony Bogdanov over 6 years
    Hey, what theme is this, it looks awesome?
  • pomsky
    pomsky over 6 years
    @TonyBogdanov It's a modified Arc theme, but I forgot from where I got it.
  • laugh salutes Monica C
    laugh salutes Monica C about 6 years
    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.
  • vivanov
    vivanov almost 6 years
    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.
  • yuranos
    yuranos over 5 years
    When I do it via Tweaks, it is not persisted. The setting disappears after a reboot.
  • pomsky
    pomsky over 5 years
    @yuranos87 Sorry, cannot reproduce! :( Works fine here even on 18.04. Did you launch Tweaks as root (or in a root session) by any chance?
  • Vlad
    Vlad over 5 years
    wow i love this tool
  • Yazon2006
    Yazon2006 almost 5 years
    Warning! This tweak lead to bug in JetBrains IDEs. When you press Alt+Shift+Something it will work only like Alt+Shift. It triggers on-press instead of on-release.
  • Mohammad Heydari
    Mohammad Heydari almost 5 years
    Works fine on 18.04 LTS
  • Jan Mares
    Jan Mares over 4 years
    This leads to another bug on Debian - L. Shift + R. Shift then also changes the layout - very annoying and difficult to fix.
  • Todor
    Todor over 4 years
    This approach should be preferred over gnome-tweaks, because with gnome-tweaks there is one side effect where in certain apps (like slack) using alt+shift not only changes the language, but also looses you the focus from the app.
  • today
    today over 4 years
    Using this method, I could switch the input languages back and forth by pressing "Left Alt+Left Shift" repeatedly; however, pressing "Right Alt+Right Shift" works only one time and pressing it again does not work (i.e. it does not switch back to the previous language). And the problem is I am used to the right combination for switching languages.
  • Jonathan La'Fey
    Jonathan La'Fey over 4 years
    On ubuntu 19.10 this had the required effect, in contrary with gnome-tweaks which didn't seem to be working for alt+shift
  • bluepearlsky
    bluepearlsky about 4 years
    Brilliant way to achieve this. Worked instantly on Ubunu 18.04.3 LTS with Unity desktop.
  • Eugene
    Eugene about 4 years
    it doesnt work on my side. i have unchecked the ckeckbox as on the screen above and run in the terminal these two gsettings commands, but when i click alt+shift or shift+alt nothing happens and layout not changed... how to force this gsettings to work ?
  • Arxeiss
    Arxeiss almost 4 years
    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
  • y.bregey
    y.bregey almost 4 years
    the only one that worked for me on Ubuntu 18.04.4. thanks!
  • y.bregey
    y.bregey almost 4 years
    gnome tweaks worked for me only with some other combinations but alt+shift on Ubuntu 18.04.4.
  • undefined
    undefined over 3 years
    Selecting Alt+Shift will not work if you press Shift first. And there is no option Shift+Alt in the settings. That's a bit of a bummer
  • undefined
    undefined over 3 years
    @laughsalutesMonicaC On Windows, you can press either of the keys first. I'd actually like to see that on Ubuntu as well. Having used Windows for so long, I am used to pressing shift first since it's a bigger key on my keyboard and right next to my little finger.
  • rustyx
    rustyx about 3 years
    Note that this setting completely hogs up Alt-Shift, making it impossible to use in e.g. Alt-Shift-Tab. See bug #36812.
  • rubmz
    rubmz over 2 years
    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']"