Chapter 3. Developer's Guide to KKBSwitch

KKBSwitch can be manipulated programmatically via DCOP. It exports an interface named KBSwitchIntf. The interface offers the following methods.

int getNumKbdGroups();

This method returns the number of configured keyboard groups (layouts).

ASYNC selectNextGroup();

This method does the same thing as clicking on the KKBSwitch's tray icon, i.e. makes the next keyboard layout active. If in "toggle mode", toggles between the two recently used ones, just like clicking on the tray icon does.

ASYNC selectGroup(groupno);
int groupno;

This method makes the layout whose number is groupno active (like selecting a layout from the tray icon popup menu).

QStringList getGroupNames();

This method returns the list of the keyboard layout names, as configured in XKeyboard.


The following examples illustrate how one can manipulate KKBSwitch with the command line tool dcop.

Select the next keyboard group (layout):

% dcop kkbswitch KBSwitchIntf selectNextGroup 

Select the group (layout) number 0:

% dcop kkbswitch KBSwitchIntf selectGroup 0