ArchLUG Kwiki - www.archlug.org

Download the RSS XML Feed for this site

Download the RSS XML Feed for this site

Subscribe to this channel with Amphetadesk

Subscribe to this channel with RadioUserland

Add to Google

XandrosAndHotKeys


Configuring Hotkeys in Xandros

Adapted from http://forums.xandros.com/viewtopic.php?t=857

Adding Support for Special Keys

Using the hotkeys Utility


Introduction

Many keyboards include special keys for launching an e-mail program, web browser, multimedia player, etc. By default these do not do anything under Xandros Desktop. By using the "hotkeys" utility you can configure Xandros Desktop to perform commands when these keys are pressed. This HOWTO outlines the steps to enable and configure the hotkeys utility.

Note that "hotkeys" is an open source program, not developed by Xandros. This solution is not ideal and requires knowledge of how to edit configuration files and run shell commands from a Console window. Xandros hopes to provide a more user friendly solution in the future.

Configuration Steps

1. Make sure the "hotkeys" package is installed.

The "hotkeys" package is installed as part of the Xandros install. You can verify that it is installed by opening a Console window and typing "hotkeys -h". It should produce an output like the following:

HOTKEYS v0.5.5 -- use the hotkeys on your Internet/multimedia keyboard 
to control your computer (compile options: XOSD)
Usage: hotkeys [options...]
Legal options:
-t, --type=TYPE Specify the keyboard type (refer to -l)
-l, --kbd-list Show all supported keyboards
-d, --cdrom-dev=DEVICE Specify the CDROM/DVDROM device, or 'none'
-o, --osd=STATE Turn off/on on-screen display
-L, --loglevel=LEVEL Set the log level in syslog [0-7]
-b, --background Run in background
-F, --fix-vmware=TIME Use this if you use vmware at the same time
-Z, --no-splash No splash screen
-h, --help Print this message

If you see a "bash: hotkeys: command not found" error message then the package is not installed. You can install it using Xandros Networks. Use the search feature to look for a package called hotkeys".

2. Configure for your keyboard type

The hotkeys program supports a number of common keyboards. You need to determine which model you have. Run "hotkeys -l" from a Console window and look for a model which matches the type of keyboard you have. If you don't see you model listed you can try using a similar one. If there is nothing that looks similar to your keyboard you can add support for new ones as described in the next section of this document.

Once you know the keyboard type, edit the file /etc/hotkeys.conf (as Administrator) to set this as the default keyboard type for hotkeys. Look for these lines near the top of the file:

### Specify the default keyboard (without the .def extension) so you
### don't need to specify -t every time
# Kbd=acerwl

And change the Kbd= line to remove the leading comment characters ("#") and set to your keyboard type as shown in the first column of the output from "hotkeys -l". For example, if you have a Compaq KB-9963 keyboard, the line would look like:

Kbd=kb9963

3. Test it

You can now test the configuration. From a Console window, run "hotkeys" and try pressing some of the keys. If at least some of them are functional (i.e. pressing them causing something to happen) then you are ready to proceed to the next step. Press <Control>+C to quit the program.

If no keys appear to work, try using other keyboard types in the hotkeys.conf file and restarting hotkeys. If that still doesn't work, see the next section on adding support for new keyboards.

4. Customize hotkey actions.

The actions for the keys are defined in the file /etc/hotkeys.conf. You'll probably want to change some of these to reflect your preferences and the programs available on Xandros.

In particular, you'll probably want to set the Calculator program to be "kcalc", rather than "xcalc", the Shell to be "konsole" rather than "xterm", and the file manager commands to use " XandrosFileManager" rather than "gmc". The actions associated with the keys do not have to match what may be written on them.

5. Configure hotkeys to run on login

In order to have hotkeys run automatically on login, you can install a file called /usr/share/autostart/hotkeys.desktop containing these lines:

[Desktop Entry]
Exec=/usr/bin/hotkeys
Icon=exec
Name=hotkeys
Name[C]=hotkeys
Type=Application
Comment=Hot keys utility
Terminal=0
X-KDE-StartupNotify=false

Adding Support For New Keyboards

If you keyboard type is not supported you can add support by creating a keyboard configuration file for it in the /usr/share/hotkeys directory. This file is in XML format and describes the key names and hardware key codes sent by the keys. You can use an existing file as a template to create the new file. The format is reasonably straightforward. To determine the keycodes sent by the keys, run the program "xev" from a Console window.

As an example, here is a file I created for a Silitek SK-1689 keyboard on one of my systems. After saving it as the file /usr/share/hotkeys/sk1689.def, the hotkeys program recognizes "sk1689" as a new keyboard type.

<?xml version="1.0"?>
<definition>
<CONFIG model="Silitek SK-1689 Keyboard">

<NextTrack keycode="153"/>
<Mute keycode="160"/>
<Calculator keycode="161"/>
<Play keycode="162"/>
<Stop keycode="164"/>
<VolDown keycode="174" adj="2"/>
<VolUp keycode="176" adj="2"/>
<WebBrowser keycode="178"/>
Power
<Sleep keycode="223"/>
<Search keycode="229"/>
<Favorites keycode="230"/>
Refresh
WWW Stop
WWW Forward
WWW Back
<MyComputer keycode="235"/>
<Email keycode="236"/>
Media Select
</CONFIG>
</definition>

Known Issues

The power management functions check that you are running as administrator, and if not, refuse to run and cause the hotkeys program to exit. This is hard coded in the program and cannot be configured.

Some keyboards have special keys that do not send key codes. These cannot be used by the hotkeys program.

References

For more information see the man page for "hotkeys" (you can view it from the Help Center).


Back to XandrosKwikis


Valid XHTML 1.0! Valid CSS!
InterTran (www.tranexp.com)
InterTran (www.tranexp.com)

Please MOVE AND HOLD your MOUSE CURSOR over any WORD in the translated web page in order to see a pop-up window with ALTERNATIVE TRANSLATIONS. Translations provided by: www.tranexp.com