LaoBlog

Switch Keyboard Map/Layout with bash


Using LXDE on Mageia Linux, I've found out that there's no way to switch from the default language keyboard map to anotherone. To accomplish this, I've found on Ubuntu forum how to modify .bashrc so that a new key combination will be load at every new session, every time I login on my computer. I need to modify the hidden file .bashrc inside my Home folder (the same for the other users, in case of need). Here is how the new .bashrc should look like:# .bashrc# Source global definitionsif [ -f /etc/bashrc ]; then . /etc/bashrcfi# User specific aliases and functionssetxkbmap -layout "it,us" -option "grp:alt_shift_toggleIn this hase I've written the language code fot the Italian keyboard layout and for the US. Chose the language codes you need.Once modified that file, disconnect from the session and login again, or type on a terminal:#source .bashrcThe late command will read .bashrc so that it will immediately take effect.To swith from a language map to another, press ALT+SHIFT. Of course you can directly change this key combination inside the .bashrc file.