12

What I want is to be able to press:

Ctrl + Shift + 1 - switch to English keyboard layout
Ctrl + Shift + 2 - switch to Hebrew keyboard layout
Ctrl + Shift + 3 - switch to Russian(Phonetic) keyboard layout

I've seen similar questions already asked here, but only answers I saw used setxkbmap which breaks the UI keyboard layout selector, which is something undesired.

Thanks for any help.

5
  • As for as I know, Set "X" KeyboardBoard Map is already for the U.I. we are talking about. And the console U.I. alternative of setxkbmap should be loadkeys. What do you mean by saying "Breaks the UI" Oct 18, 2012 at 14:08
  • @erdemkeren On the top right corner of the screen one of the buttons has a keyboard picture the code of currently selected keyboard layout. When clicked it shows a list of available layouts. Also, you can configure key combinations such as Alt+Shift to switch between those. Once you run setxkbmap this list is reset to include only the language you have just mentioned to setxkbmap.
    – Svarog
    Oct 18, 2012 at 14:27
  • Did you try IBus.
    – saji89
    Oct 21, 2012 at 11:20
  • @saji89 Never heared about it before. Will take a look. Thanks.
    – Svarog
    Oct 21, 2012 at 12:25
  • 1
    @saji89 I've tryed playing a bit with iBus, don't see how much it helps me.
    – Svarog
    Oct 21, 2012 at 12:37

3 Answers 3

1

If you are using Ubuntu you can set the default "Keyboard Layout" settings to change between keyboard layouts. However you cannot use the keyboard shortcuts you have listed. I do not know the way to do that.

If you open the system settings menu navigate to keyboard layout. Once open you will see your current keyboard layouts. If you click options and select "Key(s) to change layout, you can select which combo to change the layout. Some of the combos are

Alt+Caps Lock

Alt+Ctrl

Alt+Shift

Both Alt keys together, etc.

However thers is no way to set your own custom shortcuts. I attempted to see if there was possible a terminal code but there is no manual entry for Keyboard Layout settings, such as there is for other programs like Firefox: man firefoxIf there were you could easy create a custom key combo to run the command depending on which layout you want.

Additionally there is no indicator of which layout you've switched too and the only way to check is to type something. But it does seem to go in order of the way the layouts are listed.

Screen shot of the keyboard layout options menu

I hope that helps you.

4
  • Thanks for the information, but I've already known that, and this is not what I'm looking for.
    – Svarog
    Oct 20, 2012 at 8:25
  • Please elaborate on what the difference is to what you want, what this answer describes and why you cannot use it.
    – jippie
    Oct 21, 2012 at 19:16
  • @jippie - All those settings only allow to change the layout to the next layout. I.E. For example I have 3 keyboard layouts: English, Hebrew, Russian. If I'm currently typing in English, and then I press the selected keystroke, I'll move to Hebrew. Another keystroke - Russian. Next keystroke - back to English. What I'm looking for is a way to create 3 keystrokes that will switch me to English, Hebrew or Russian respectively, with no regard to which layout I'm currently on. a.k.a. Press Ctrl+Shift+3, and know for sure I'm typing in Russian now.
    – Svarog
    Oct 23, 2012 at 11:09
  • Probably of little use to you, but in Kubuntu (KDE based) => Keyboard settings => Layout Allows me to configure a custom shortcut. Don't know if you can use de KDE settings tool, probably not. Are you sure there is no means of setting a custom shortcut?
    – jippie
    Oct 23, 2012 at 18:19
1
  1. Open "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts"
  2. Press "+" to create a new one
  3. Add any name you like and the following command for the first layout: gsettings set org.gnome.desktop.input-sources current 0

  4. Press "Apply"

  5. Press on "Disabled" in right column for your key mapping
  6. Assign your hot key

Screenshot for step 3: enter image description here

Screenshot for step 5: enter image description here

1
  • I suppose this works only for GNOME, but not for other DEs?
    – Suncatcher
    Mar 9, 2018 at 12:34
1

The following solution works for Ubuntu 19.10.

gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval  "imports.ui.status.keyboard.getInputSourceManager().inputSources[0].activate()"

Taken from here.

So just add key bindings you like with the index in the above command modified as desired (0 - your first layout, 1 - your second layout, and so on).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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