Change keyboard layout using Cyryllic character
Solution 1
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.
Solution 2
how to set it back to br using the Russian characters?
why not add:
alias вернуть-раскладку='setxkbmap -layout br'
or any other alias typed with Russian characters to your liking to ~/.bashrc?
Related videos on Youtube
Sigur
Updated on September 18, 2022Comments
-
Sigur over 1 year
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
-
Sigur over 10 yearsThis command also returns to default after logout?
-
Sigur over 10 years
localectl command not found
. Should I install something? -
r0berts over 10 yearssorry, I did not pay attention that ubuntu 11.10 does not use systemd
-
Sigur over 10 yearsI inserted
setxkbmap "br,ru" "grp:alt_shift_toggle"
in my file~/.bashrc
since I don't have~/.xsessionrc
. But now how can I use it? Alt+Shift does nothing. -
r0berts over 10 years~/.bashrc gets read when you launch Bash shell. So this is not what you want. ~/.xsessionrc gets read by your xsession. If you don't have the file, just create it.
touch ~/.xsessionrc
and then edit it. Also have a look at knoppix.net/forum/… Note that you can experiment with quotes, etc - syntax in this link is a bit different. -
batbrat almost 5 yearsHi, is there any clean documentation on what values KEYMAP_TOGGLE can take? I know xkeyboard-config talks about this, but I am working with a virtual terminal here.