To get worked keyboard layout well follow next steps:
1. Install x11-xkb-utils package:
# apt-get install x11-xkb-utils
2. Add the line to your ~/.xinitrc file:
setxkbmap -layout 'us,ru' -option 'grp:ctrl_shift_toggle'
Help with grp:
- grp: toggle – switch right Alt;
- grp: shift_toggle – two keys shift;
- grp: ctrl_shift_toggle – ctrl shift;
- grp: alt_shift_toggle – alt shift;
- grp: ctrl_alt_toggle – ctrl alt;
- grp: caps_toggle – switching on CapsLock;
- grp: lwin_toggle – switch on the left “Win” key on a Windows keyboard ( for the X Window older than 4.2) ;
- grp: rwin_toggle – switching from the right “Win” key on a Windows keyboard ( for the X Window older than 4.2) ;
- grp: menu_toggle – switching on the ” Context Menu ” on the Windows keyboard ( for the X Window older than 4.2) ;
- grp: lctrl_toggle – switch on the left Control key
- grp: rctrl_toggle – switching from the right Control key
- grp: switch – switch on the right Alt only at the time of pressing
- grp: lwin_switch – switch on the left Windows key only at the moment of pressing
- grp: rwin_switch – switch on the right key Windows only at the moment of pressing
- grp: win_switch – switching on any key Windows only at the moment of pressing
So simple, good luck!
See also,
http://linuxru.org/tips/41
http://ubuntologia.ru/forum/viewtopic.php?f=34&t=4245&start=10