I use extensively two keyboard layouts (latin for English, and cyrillic for Ukrainian and Russian), and it bothers me to experience my mode errors because of the additional bit of UI state: the current layout.
I used to eliminate them completely by using stateless layout switching, whereby one has no next layout
action (as such an action is based on the current state, which is easy to forget for the user, and so leads to errors), rather only two actions:
- enable latin layout;
- enable cyrillic layout.
This was trivially accomplishable in pre-Saucy releases. As illustrated on the screenshot above.
However, that settings window was destroyed in Saucy.
How do I get my stateless switching now?
This command will set layout to the first one (It works nicely with Unity/Gnome Indicator, Ubuntu 13.10/14.04):
You can use tweak tools, gnome action, compiz action plugin..etc to create a keyboard shortcut for it.
Layouts are indexed starting from 0. So you can make shortcut for any layout in the list.
You can use this to create complex script for last layout without giving an index:
Like:
The keyboard options in Ubuntu and GNOME are nothing but a frontend to the X keyboard extension (XKB). If you are fine with configuring things manually you can easily reenable all of the now-missing options with a
setxkbmap
command line.For instance, to set a non-modal switch between Russian and English keyboard layouts you can use the following command:
This will enable these XKB settings for the current session. If you want to make the change permanent you will have to add the command above to your startup applications.
If you are interested in the various other settings you can control with
setxkbmap
, I recommend going though the manual (man setxkbmap
) and taking a look at/usr/share/X11/xkb/rules/base.lst
. The latter documents all different ways to configure the compose key, keyboard layout toggle, etc.The following is the
base.lst
section on keyboard layout switching:The various XKB settings are also documented under
man 7 xkeyboard-config
.If
setxkbmap
doesn't work for you you can try setting the XKB options throughdconf
instead:dconf-editor
(sudo apt-get install dconf-editor
)xkb-options
in form of an array. E.g.:['grp:shift_caps_switch']
Source: Make setxkbmap preferences being set at startup
Maybe just using the Tweak Tool:
HTH
Turns out Cinnamon desktop has that option still! Nice.