How can you change the keyboard layout (to QWERTY from QWERTZ) on the fly from a Linux shell?
I found this similar question, but the answer was to edit a config file, which is not so easy when you're using a Live CD.
How can you change the keyboard layout (to QWERTY from QWERTZ) on the fly from a Linux shell?
I found this similar question, but the answer was to edit a config file, which is not so easy when you're using a Live CD.
kbdconfig or loadkeys
That's how we used to do it. I don't know if they're still supported; I'll check next time I've got Knoppix running.
I'm not aware of any tool that changes keymap on-the-fly, but in at least debian it is possible to edit /etc/default/console-setup
with your preferred map, and make the system reflect those changes by issuing /etc/init.d/hal restart
.
On recent systems, if you have root privileges, you can use the following:
localectl set-keymap en_GB
for the virtual console keyboard, and
localectl set-x11-keymap en_GB
for the X11 layout.
Another option:
Go in the menu and add your layout to keyboard:
System->Preferences->Keyboard, where choose Layouts tab and add your language (the default is the one chosen at installation time). Then you can press the Layout Options... button, and look in Key(s) to change layout for the hot keys that changes the Keyboard layout. For me it is Shift+Caps Lock.
Hope to help.
N.B. I'm running CentOS 6.2 with GNOME interface.
It may look hacky but it works like a charm:
setxkbmap -layout ru && setxkbmap -layout ru,us
setxkbmap -layout us && setxkbmap -layout us,ru
To force switch:
setxkbmap -layout ru && setxkbmap -layout us && setxkbmap -layout us,ru
You can program your loop if you need.