# The &kxkb; Handbook

&Andriy.Rysin; &Andriy.Rysin.mail;
&Anne-Marie.Mahfouf; &Anne-Marie.Mahfouf.mail;
&Andriy.Rysin; &Andriy.Rysin.mail;
2003
&Andriy.Rysin;
2006
&Anne-Marie.Mahfouf;
&FDLNotice;
2006-02-16
3.5.2

&kxkb; is a keyboard layout switching utility based on X11 xkb extension.

KDE
kxkb
keyboard
layout

## Introduction

&kxkb; is the &kde; keyboard layout switching utility. It is based on X11 xkb extension and allows to use different keyboard layouts for inputing text. &kxkb; features keyboard layout indicator.

## Using &kxkb;

### Getting Started

&kxkb; starts automatically and stays in system tray as a flag with 2 or 3 letter abbreviation of layout name on top of it if more than one layout is defined or Show indicator for single layout option is turned on.

When &kxkb; is running you can change layouts clicking on its tray icon with the mouse or pressing its keyboard shortcut. Keyboard shortcut or mouse click will switch to next layout or alternatively you can &RMB; click the &kxkb; icon and select layout from the list.

&RMB; clicking on the &kxkb; icon you can start its configuration by selecting Configure... or by opening Control Center and selecting Localization/Keyboard Layout. Alternatively, you can start it by typing `kcmshell keyboard_layout` in a terminal.

## Configuring &kxkb;

### General Information

&kxkb; Configuration consists of three tabs: Layout, Switching Options and Xkb Options. Layout and Xkb Options are mutually independent. The Layout tab defines layouts you want to use and their options, the Switching Options tab defines how you want to switch keyboards and the Xkb Otions tab defines parameters for Xkb extension on which &kxkb; is based. Xkb options are property of X and are not handled in any way by &kxkb; - it just sets it up.

&kxkb; configuration does not change anything in XFree86 configuration files and Layout settings from XFree86 configuration are overridden by &kxkb; if `Enable keyboard layout` option is turned on.

To make your XFree86 configuration work you have to turn off both `Enable keyboard layout` in layout configuration tab and `Enable xkb options` in Xkb options configuration tab (for the latter the same effect can be reached if `Reset Old Options` is turned off and none of xkb options are set).

&kxkb; does most of its actions through `setxkbmap` command. You can see the commandline to be executed for each active layout when you select it and, on the xkb options tab, its available xkb option set.

### Layout Configuration

The Layout tab
The Layout tab

In layout configuration dialog the list of available layouts on your left. You have to choose each layout you want to use and add them (one by one) to the list of active layouts on the right. You can also change the order in which active layouts will be switched when toggled by keyboard shortcut or mouse button. The first layout in the list becomes default layout.

Some layouts have several variants. Layout variants usually represent different key maps for the same language. For example, Ukrainian layout might have four variants: basic, winkeys (as in Windows), typewriter (as in typewriters) and phonetic (each Ukrainian letter is placed on a transliterated latin one). If your layout is multi-variant one you can the variant in combobox below the active layouts list.

Keyboard model setting is independent of your keyboard layout and refers to the "hardware" model, i.e. the way your keyboard is manufactured. Modern keyboards that come with your computer usually have two extra keys and are referred to as "104-key" models, which is probably what you want if you don't know what kind of keyboard you have.

You can also choose switching policy for keyboard layout. By default it's `Global meaning` all applications will share the same current layout. `Application` means each application will have it's own layout and switching layout while you are working with one application will not impact layout for any others. `Window` will make every window have its own layout even if they belong to the same program.

If you set only one active layout, at startup kxkb configures the keyboard and exits thus its indicator will not appear. If you still want kxkb indicator select `Show indicator for single layout` option.

If you leave active layout list empty keyboard layouts will be disabled

### Switching Options

The Switching Options tab
The Switching Options tab

Show indicator for single layout

  Shows icon in system tray even when thee is only one layout.

Show country flag

  Shows country flag on background of layout name in tray icon.

Switching Policy

  If you select Application or Window switching policy, changing the keyboard layout will only affect the current application or window. Global will make the switching policy work globally for all applications and windows.

Sticky Switching

  If you have more than two layouts and check Enable sticky switching, switching with the keyboard shortcut or clicking on the kxkb indicator will only cycle through the last few layouts. You can specify the number of layouts to rotate below in the Number of layouts to rotate box. You can still access all layouts by right-clicking on the &kxkb; indicator.

### XKB Options Configuration

The Xkb tab
The Xkb tab

Xkb options allow you to select behavior of your keyboard. These options are not handled by &kxkb; but may help tune your keyboard to your needs. You can set Xkb extension options instead of, or in addition to, specifying them in the X11 configuration file.

## Troubleshooting

### Common Problems

If you switch to some layout and you can not see some characters from your layout as you type, please check your local settings. &eg; `~/.i18n` or `/etc/sysconfig/i18n`, locale you have before starting kde applications must have an encoding which contains characters from your layout. For example, to enter ukrainian symbols you must have encoding KOI8-U, CP1251 or UTF-8. The last one is a good choice to try for most of the languages if you have such a problem.

If kxkb does not switch with keyboard shortcut when you switch it to some layout but switching with mouse is ok may mean that your layout does not contain the key assigned in shortcut.

In XFree86 prior to version 4.3.0 non-latin layouts mutually included latin group and this group was the default thus pressing &Ctrl;&Alt;k always yielded the right combination. From version 4.3.0 by default all layouts contain only one group thus non-latin layouts may not work here.

Possible solutions are:

1. add your layout to $nonlatin or $oldlayouts lists in `/etc/X11/xkb/rules/xfree86` or the location of the xkb rules on your computer.

2. Change the shortcut to something language neutral, &eg; &Ctrl;Menu

3. Turn on the option to include the us group in your layout (effectively the same as solution 1).

## Files and Layout Descriptions

### xkb Files and Layouts

All available keyboard layouts are described in `/etc/X11/xkb/rules/xfree86.lst` (and `/etc/X11/xkb/rules/xfree86.xml` since XFree86 4.3.0), the layouts themselves can be found in `/etc/X11/xkb/symbols/pc` (or `/etc/X11/xkb/symbols` for XFree86 4.2.x and older). Note that the location of these files may differ depending on your operating system and distribution.

&kxkb; now uses the xkb extension instead of xmodmap, so to define your own layout you have to get one from `/etc/X11/xkb/symbols` which is closest to what you want to get (or `/etc/X11/xkb/symbold/pc` for XFree86 4.3.0), rename it to something you like and edit it. Then just add the name to `/etc/X11/xkb/rules/xfree86.lst` (and for XFree86 4.3.0 or later it is a good idea to add the name also to `/etc/X11/xkb/ruls/xfree86.xml` - some packages already use it, not &kxkb; though yet) kxkb will pick it up on restart. Note: you have to be root to edit those files.

## Credits and Licenses

&kxkb; is currently developed and maintained by Andriy Rysin rysin@kde.org. Several other people have worked on kxkb:

- Shaheed Haque srhaque@iee.org

- Ilya Konstantinov kde-devel@future.galanet.net

&underFDL; &underGPL;