Localization/Changing Keyboard Layout

From OLPC
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Changing the keyboard configuration file

The keyboard layout settings in an XO is stored in the file /etc/sysconfig/keyboard. The easiest way to change the keyboard layout is to edit this file. However, please note that any OS upgrade will reset the keyboard configuration back to the original edition.

Understanding the contents of the the /etc/sysconfig/keyboard file

A typical keyboard configuration file looks like

KEYTABLE="us"
XKB_MODEL="olpc"
XKB_LAYOUT="us"
XKB_VARIANT="olpc"

Typically the values of XKB_LAYOUT and XKB_VARIANT need to be changed, the other two variables can be left as is. The value of XKB_LAYOUT signifies the layout to be used, by convention it is usually country specific (eg: us, tr, mn, in, etc). The XKB_VARIANT value indicates the variant to be used, eg: the "us" keyboard may have a qwerty variant, and a dvorak variant.

Choosing the right values for XKB_LAYOUT and XKB_VARIANT

The list of keyboards that are supported (or are in the process of being supported) are listed at the Manufacturing Data page. For each layout, there is a corresponding value in the KL and KV columns. The KL value should go in XKB_LAYOUT, and the KV value should go in XKB_VARIANT. For example, for the Mongolian Keyboard, the /etc/sysconfig/keyboard looks like

KEYTABLE="us"
XKB_MODEL="olpc"
XKB_LAYOUT="us,mn"
XKB_VARIANT="olpc2,olpc"

Activating the new keyboard layout

Once the requisite changes are made to /etc/sysconfig/keyboard, a restart of sugar with the ctrl-alt-erase keypress should activate the new keyboard layout. Before restarting sugar, all activities must be stopped.

Toggling between two keyboard layouts

The key sequence to toggle between two keyboard layouts may be set with XKBOPTIONS.

In this example pressing both left and right Shift keys will toggle the keyboard.

KEYTABLE="us"
XKB_MODEL="olpc"
XKB_LAYOUT="us,mn"
XKB_VARIANT="olpc2,olpc"
XKBOPTIONS="grp:shifts_toggle"

See also: http://wiki.laptop.org/go/OLPC_Khmer_Keyboard#OLPC_section_of_the_XKB_symbol_file