Ubuntu – Switch to specific keyboard layout using Ctrl+Shift+Num

keyboardkeyboard-layout

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.

Best Answer

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.

Related Question