Switch to specific keyboard layout using Ctrl+Shift+Num
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.
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 firefox
If 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.
I hope that helps you.
- Open "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts"
- Press "+" to create a new one
Add any name you like and the following command for the first layout:
gsettings set org.gnome.desktop.input-sources current 0
Press "Apply"
- Press on "Disabled" in right column for your key mapping
- Assign your hot key
Screenshot for step 3:
Screenshot for step 5: