Ubuntu – Change keyboard layout using Cyryllic character

keyboard-layoutlubuntux11

I'm using Lubuntu 11.10. I tried the keyboard layout applet from lxpanel but it does not work and I don't know why.

I can change the layout to Russian using

$ setxkbmap ru

and it works! Nice! But the problem is: how to set it back to br using the Russian characters? That is, what should I type on a Russian keyboard to get the same result as

$ setxkbmap br

Best Answer

This is, as I discovered some time ago, tricky business with the Russian layout :) - but tricky only because you have cyrillic letters coming up in console and do not know the current keyboard shortcut to switch the layout. Good news is that everything set by setxkbmap will only persist till you logout, then defaults will come back on the next time. That is also why I prefer to get one of the keyboard switching applets working.

However in your case if you use:

localectl set-x11-keymap br,ru grp:alt_shift_toggle

or setxkbmap "br,ru" "grp:alt_shift_toggle"

you should be able to perform switching with Alt+Shift combination, despite not having a working applet. It should work with more than 2 layouts too. This will only persist until logout, however if you edit /etc/vconsole.conf - the changes will pesrist.

KEYMAP="br,ru"
KEYMAP_TOGGLE="grp:alt_shift_toggle"

However this will only work with systemd startup - like in Fedora (which I happen to use). Ubuntu 11.10 does not yet use systemd. In that case you can either edit xorg.conf or /etc/hal/fdi/policy/10-keymap.fdi but an easier solution would be to invoke setxkbmap as you start your x session:

in file ~/.xsessionrc

You put command:

setxkbmap "br,ru" "grp:alt_shift_toggle"

That should sort it for you.

Related Question