Introduction to KeyHelper
From OESF
Contents |
Introduction
Many of you are probably aware of the keymapping abilities of KeyHelper, but you may not be aware of some of the other features including:
- Changing key repeat rates
- Task Switching
- Task Selection from list
- Application launching
- from hot key
- from menu
Most of the examples below were taken from [this very helpful tutorial on KeyHelper| http://www.yo.rim.or.jp/~mono93/mobile/linuxzau/slc700_keyhelper01.html] (warning in Japanese) and from the [KeyHelper Home Page|http://yakty.s31.xrea.com/linuzau/]. Any mistakes in this document are mine and probably due to my poor Japanese and typing skills.
Note that if you're running Cacko Qtopia ROM version 1.21 and above, KeyHelper functionality is merged with Cyrillica keyboard layout applet. No separate KeyHelper package installation is requried.
The following example is a simple keyhelper.xml files which sets the [[Kana] key (1st Japanese key) to [[Ctrl], turns on toggle for [[Shift], maps [[Fn]+O and [[Fn]+P as { and } and defines [[Home] as the task switch key.
- <?xml version="1.0"?>
- <keyhelper>
- <modifiers>
- <define key="F26" type="Control">
- <release key="F31"/>
- </define>
- <define key="F12" type="User1">
- </define>
- <define key="Shift" type="Shift" toggle="True"/>
- </modifiers>
- <mappings>
- <define code="2015">
- <map_modifier Shift="On"/>
- <map key="Less"/>
- </define>
- <define code="2016">
- <map_modifier Shift="On"/>
- <map key="Greater"/>
- </define>
- </mappings>
- <repeater>
- <repeat delay="300" period="30"/>
- </repeater>
- <extensions>
- <define key="F12" kind="switch">
- <modifier Shift="On"/>
- </define>
- <define key="All" kind="launch">
- <modifier User1="On"/>
- </define>
- </extensions>
- </keyhelper>
By copying and pasting this into a file named keyhelper.xml and copying it into /home/zaurus/Settings and running khctl reload from the console you will have a [[Ctrl] key, [[Shift] will be a toggle, [[Fn]+O/P will give {/} and [[Shift]+[[Home] will switch between running apps.
The keyhelper.xml file has 4 sections
- <modifiers> - changes/assigns keys such as [[Shift], [[Ctrl], [[Alt] as well as the ornamental keys [[Home], [[Address] etc.
- <mappings> - changes mapping of normal keys or key combos
- <repeater> - sets the key repeat rate
- <extensions> - changes what keys are used for special keyhelper functions - task switcher, task selector and launcher.
I'll explain these section in more detail as well as give examples below.
Modifiers
Some examples will help to explain the format of this section.
- <define key="F26" type="Control" mapping="True">
- <release key="F31"/>
- </define>
<define key="F26" type="Control" mapping="True"> Sets [[Kana] key (first Japanese key) to be the control key, key= can also be replaced by code= if you prefer to set a key combination to be a modifier key. type= is one of the "Ornamental" keys ([[Address],[[Home],[[Calendar],[[Mail],[[Menu]) or the standard modifier keys ([[Shift],[[Ctrl],[[Alt]). Setting mapping="True" and not supplying a mapping in the <mapping> section makes this key lose its normal function. In the above example the [[Kana] key will no longer switch between hiragana and katakana - it will only act as [Ctrl].
- <define key="Shift" type="Shift" toggle="True"/>
This short example higlights the toggle="True" feature which turns on the toggle feature for modifier keys.
Mapping Keys
Mapping keys is a relatively simple matter of working out the key/code you want to change and the key/code you want it to be. Here are 2 examples
- <define code="2015">
- <map_modifier Shift="On"/>
- <map key="Less"/>
- </define>
This is a simple example to start <define code="2015"> is the key code we want to change (in this case [[Fn]+O), we could also use <define key="P"> if we wanted to change the function of the P key. <map key="Less"/>' identifies what we want the changed key/code to be. It can also be modified with [[Alt],[[Ctrl],[[Shift] etc with the <map_modifier Shift="On"/> line. In this example we have changed [[Fn]+O to [[Shift]+[[Less] ({ key).
- <define key="F26">
- <modifier Shift="On"/>
- <map key="Alt"/>
- <map_modifier Shift="Off"/>
- </define>
The second example maps the [[Alt] key to [[Shift]+[[Ctrl] - remember that the first Japanese key = [[Ctrl]. <define key="F26"> is the first Japanese key, <modifier Shift="On"/> means that we only map the key when pressed with [[Shift], as in the previous example <map key="Alt"/> sets the key we want, and the <map_modifier Shift="Off"/> cancels the [[Shift] button.
Key Repeat
- <repeater>
- <repeat delay="300" period="30" mode="1"/>
- </repeater>
This is a nice simple example that turns on key repeat, with a delay of 300 milliseconds and a repeat rate of 30 milliseconds.
KeyHelper Extensions
KeyHelper offers a number of extended features that are quite useful. The example below shows how to set up task switching and task selection.
- <define key="F12" kind="switch">
- <modifier Shift="On"/>
- </define>
- <define key="F11" kind="select">
- <modifier Shift="On"/>
- </define>
With this example [[Shift]+[[Home] can be used to switch between running applications, while [[Shift]+[[Menu] will bring up a list of active applications allowing you to select which one to switch to.
More to come on using KeyHelper as a program launcher and other goodies once I understand and work out what I'm doing - StuBear

