140

Can I use Ctrl+Shift for changing languages? I can't set this hotkey for changing keyboard languages.

At this moment Alt+Shift switch languages, but I can't see this hotkey in keyboard hotkeys list or in

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

output.

graham
  • 10,436
Hayate
  • 1,503
  • 2
  • 10
  • 9

2 Answers2

285

You can set such keyboard shortcut as follows:

  • On Ubuntu 18.04 LTS, 20.04 LTS, 21.04 and 21.10 with GNOME desktop from GNOME Tweaks.

    1. Install it

      sudo apt-get install gnome-tweaks
      
    2. Then open GNOME Tweaks (gnome-tweaks).

    3. Select Keyboard & Mouse tab

    4. Click Additional Layout Options button

    5. Expand Switching to another layout

    6. Select Ctrl + Shift here

    See screenshot below:

    GNOME Tweaks - set <Ctrl+Shift>

    Or simply:

    gsettings set org.gnome.desktop.input-sources xkb-options \
      "['grp:ctrl_shift_toggle']"
    

    If you do not like Super + Space and Shift+Super+Space you can disable them with

    gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['']"
    gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward  "['']"
    gsettings set org.freedesktop.ibus.general.hotkey triggers "['']"
    

    Note: you will face interference problem as Ctrl+Shift+T in GNOME Terminal will switch language at once with opening new tab. It is known bug 1683383.

  • On Ubuntu MATE 18.04 LTS and newer versions this is possible from mate-keyboard-properties:

    1. Open MATE Control Center
    2. Click Keyboard
    3. Go to Layouts tab
    4. Click Options
    5. Expand Switching to another layout
    6. Select Ctrl + Shift here

    See screenshot below:

    MATE Control Center keyboard

    Or simply:

    gsettings set org.mate.peripherals-keyboard-xkb.kbd options \
          "['grp\tgrp:ctrl_shift_toggle']"
    

    Note: here bug 1683383 is fixed by packages from my PPA :

    sudo add-apt-repository ppa:nrbrtx/xorg-hotkeys
    sudo apt-get update
    sudo apt-get dist-upgrade
    

    So Ctrl + Shift keyboard layout switcher will work normally on MATE DE after applying patch from ArchLinux AUR "for freedesktop bug 865 (need to kick hotkeys on release, not press)".

    Warranty disclaimer: packages were tested in

    • 16.04 LTS with HWE (Unity, MATE, Xfce)
    • 18.04 LTS (Cinnamon, KDE, MATE, Xfce)
    • 18.10 (Cinnamon, KDE, MATE, Xfce)
    • 19.04 (Cinnamon, KDE, MATE, Unity, Xfce).
    • 19.10 (Cinnamon, KDE, MATE, Unity, Xfce)
    • 20.04 LTS (Cinnamon, KDE, MATE, Unity, Xfce)
    • 20.10 (Cinnamon, KDE, MATE, Unity, Xfce)
    • 21.04 (Cinnamon, KDE, MATE, Xfce)
    • 21.10 (Cinnamon, KDE, MATE, Xfce)

    However other desktops may have issues even after applying the patch.
    These packages do not fix problems for GNOME Shell (18.04 LTS, 18.10, 19.04, 19.10, 20.04 LTS, 20.10 and 21.04) and Unity (in 18.04 LTS and 18.10).


If you are interested you can participate in poll and discussion on community.ubuntu.com.

N0rbert
  • 99,918
  • 8
    gnome-tweaks broke text selection via ctrl+shift+arrow :( Does another solutions allow such text selection? – Hayate Apr 30 '18 at 05:34
  • You have been warned about this. Possible solution is to switch to normal DE such as MATE, Xfce, Cinnamon, KDE. See links in my answer. – N0rbert Apr 30 '18 at 09:45
  • Ok, i see, thx. – Hayate May 01 '18 at 02:14
  • 3
    Works fine on Ubuntu 18.04.1 LTS. – Hemã Vidal Sep 10 '18 at 00:46
  • 3
    Thanks, it works fine :) It is really sad that you can't do that without installing a program, bad UX. – gdaras Nov 24 '18 at 13:15
  • For some reason this answer does not work for me (ctrl+shift) does nothing after performing the steps but Ezze's answer with dconf-editor does. – Andrew Savinykh Dec 01 '18 at 01:16
  • @AndrewSavinykh please remove your comment from here and write it below Ezze answer. I can't give any warranty on Ezze's solution. – N0rbert Dec 01 '18 at 08:06
  • Is it normal that for changing language 1 to 2, I should have use Shift+right Alt, and for language 2 to 1, I should have use Shift + left Alt? – user3933607 Dec 29 '19 at 17:44
  • @user3933607 if you are talking about GNOME, I can't help here. Other normal DEs should work by using simple <Alt>+<Shift> in cycle. – N0rbert Dec 29 '19 at 17:55
  • Ya, Ubuntu 18.04.3 LTS, Gnome 3.28.2. – user3933607 Dec 29 '19 at 20:19
  • That of course works for changing language, but, beware that alt+shift+key combinations will not work good. See https://askubuntu.com/a/1094249 So my personal solution is stick with defaults whatever ugly they are – Mikhail Boyarsky Feb 27 '20 at 20:43
  • 2
    @MikhailBoyarsky the solution is to ignore GNOME and use any other DE instead. The packages from my PPA was tested on Cinnamon, KDE, MATE, Unity, Xfce. – N0rbert Feb 28 '20 at 13:47
  • 4
    I read your thread, indeed it is very huevo that gnome maintainers dont pick existing patches about shift alt or so. It is totally doable and worked forever on windows. – Mikhail Boyarsky Feb 29 '20 at 01:49
  • @N0rbert, will it work with Ubuntu 20.04? – ezze Apr 19 '20 at 10:49
  • 1
    @ezze, yes it should. I have created packages for 20.04 LTS (focal) in my PPA. – N0rbert Apr 19 '20 at 10:50
  • Setting Ctrl-Shift in GNOME tweaks breaks all other combinations, which includes Ctrl-Shift. It is a bug. – Dims Jun 12 '20 at 08:16
  • 1
    @Dims I'm not responsive for the bugs in the GNOME Tweak and GNOME Shell. Delete GNOME Shell from the system, and simply do not use it. See my answer to know how. If you plan to do real work in productive way with Ctrl+Shift enabled - add my PPA and use MATE or KDE instead. – N0rbert Jun 12 '20 at 08:24
  • I googled a long time on how to disable ctrl+shift combination selected during ubuntu installation, this combination led me to effect described in first comment... didn't see that gnome-tweaks also contains keyboard settings, thx – cybersoft Oct 28 '20 at 17:15
  • awesome :D, I has been find it for a long time. – nobjta_9x_tq Jan 13 '21 at 10:28
  • @N0rbert, I updated a system today and your patch doesn't work anymore for me. These are updated packages I found in /var/log/apt/history.log: xserver-common:amd64 (2:1.20.9-2ubuntu1.1~20.04.1ubuntu1ppa4, 2:1.20.9-2ubuntu1.2~20.04.1), xserver-xorg-core:amd64 (2:1.20.9-2ubuntu1.1~20.04.1ubuntu1ppa4, 2:1.20.9-2ubuntu1.2~20.04.1), python3-pil:amd64 (7.0.0-4ubuntu0.1, 7.0.0-4ubuntu0.2), xserver-xorg-legacy:amd64 (2:1.20.9-2ubuntu1.1~20.04.1ubuntu1ppa4, 2:1.20.9-2ubuntu1.2~20.04.1). Any chance to fix it now? – ezze Jan 19 '21 at 16:07
  • @N0rbert, this is how I downgraded affected packages to fix the issue: sudo apt install xserver-common:amd64=2:1.20.9-2ubuntu1.1~20.04.1ubuntu1ppa4 xserver-xorg-core:amd64=2:1.20.9-2ubuntu1.1~20.04.1ubuntu1ppa4 xserver-xorg-legacy:amd64=2:1.20.9-2ubuntu1.1~20.04.1ubuntu1ppa4 – ezze Jan 19 '21 at 16:14
  • 1
    @ezze Thank you! I have uploaded new ppa5 package version for focal. So you may want to remove your comments to keep thread clear :) – N0rbert Jan 19 '21 at 19:00
  • $ gsettings reset org.gnome.desktop.input-sources xkb-options finally removed Ctrl+Shift as secondary shortcut for next input source, that I somehow set earlier, and cannot unset with UI, while it was keeping to conflict with Shift+Ctrl+V in the terminal . – Alexander Glulkhovtsev Apr 25 '21 at 14:37
  • 1
    Works fine on Ubuntu 21.10. Thank you for the solution! – Andrew G Nov 01 '21 at 10:20
  • Still works on Ubuntu 22.04. Thanks ! – dev93 Aug 08 '22 at 15:33
  • Ubuntu 22.04 works fine, BUT - looks like if you are typing FAST - and for example you need to switch to EN and press "?"(Shift+/) then you will see "/", not "?", so looks like some delay after switching should pass. If do it some slowly - works fine, but it is not I searched. – Nigrimmist Jan 13 '23 at 10:07
25

I found a partial workaround based on other answers for using Ctrl+Shift and shortcuts for GNOME in Ubuntu 18.04:

  1. Install GNOME Tweaks as proposed in N0rbert's anwser:

    sudo apt install gnome-tweaks
    

    then:

    • run it;
    • open "Keyboard & Mouse" tab;
    • click "Additional Layout Options" button;
    • instead of selecting Ctrl+Shift key combination in "Switching to another layout" of "Additional Layout Options" window simply untick all checkboxes:

    Additional Layout Options

  2. Open "Settings" application from "Show applications" menu at the left bottom corner. Alternatively run a command in terminal:

    gnome-control-center
    

    then

    • go to "Devices" > "Keyboard" tab;
    • scroll to "Typing" group;
    • set shortcuts for "Switch to next input source" and "Switch to previous input source" (an order of keys DOES MATTER!!!):

    Keyboard settings

    If setting Ctrl+Shift or Shift+Ctrl shortcuts is impossible using this dialog (as it was in my case), then you can change these parameters in an alternative way:

    • install dconf-editor:

      sudo apt install dconf-editor
      
    • run it from terminal:

      dconf-editor
      
    • go to org > gnome > desktop > wm > keybindings;

    • select switch-input-source or switch-input-source-backward;
    • switch off "Use default value" and input "Custom Value": <Control>Shift_L for changing layout with Ctrl+Shift or <Shift>Control_L — for changing layout with Shift+Ctrl:

    dconf-editor

    Another way is to use gsettings set console command as proposed here:

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

A limitation of this solution is that an order of keys pressed is important. If you set Ctrl+Shift to change keyboard layout then it will work only when you press Ctrl key first, and then Shift key. Pressing Shift key first and Ctrl after will not work in this case. But this fact allows to use shortcuts containing Shift and Ctrl keys combination in different applications , for example:

  • Shift+Ctrl+T to open new tab in Terminal;
  • Shift+Ctrl+E to export image in Gimp;
  • Shift+Ctrl+F to open search dialog in WebStorm/PhpStorm.
N0rbert
  • 99,918
ezze
  • 800
  • 1
    Thanks for the note about Shift and Ctrl ordering – reddot Mar 13 '19 at 09:59
  • 1
    Great solution, works better than gnome-tweeks (check my comment below if you interesting why). Do we have any chance somehow to improve this behavior to fix this issue with ctrl+shift+anything (shift+ctrl+ - works fine) by... somehow to set for example event type - change when not pressing, but when already pressed. If someone will find solution, please notify :) – Nigrimmist Jan 13 '23 at 10:26
  • On my Ubuntu 23.04 the solution works partially: (1) the Shift key must be pressed twice to actually change the layout; (2) there are still some clashes with other hotkeys based on Ctrl+Shift combination. – Toparvion May 12 '23 at 04:27