Keymap.xml

Introduction
Keymaps define the mappings of keys (keyboard keys, mouse/remote/joysticks buttons and more) to XBMC actions.

In XBMC 9.11 (and higher), keymap configuration files are located in the following directories:

Example Paths:

Linux global: /usr/share/xbmc/system/keymaps/ Linux user specific: ~/.xbmc/userdata/keymaps/

Windows global: C:\Program Files\XBMC\userdata\keymaps\ Windows user specific: C:\Documents and Settings\Username\Application Data\XBMC\userdata\keymaps\

All *.xml files in these folders are applied as keymaps. Keymaps defined in user folders add to or override mappings in the global keymap.

Default keymaps shipped with xbmc

In versions prior to 9.11, keymap configuration was handled by the keymap.xml file.

Structure
There is one global keymap and several window-specific keymaps. XBMC falls back to the global map when the window-specific map hasn't bound the key being pressed.

The format of keymapping files is as follows:

As you can see, it's divided into a section, and a number of window sections (such as ). A list of the available window names can be seen here Window IDs. The WINDOW can also be a custom window formatted as  (e. g. ). Each of these sections can contain Gamepad, Remote, Keyboard, Universal Remote, and custom Joystick sections.

The format for mapping a particular key under one of these device types is as follows:

Gamepad Section
An up to date list of the available actions can be found in the source code of XBMC in ButtonTranslator.cpp where the TranslateGamepadString function does the work.

Example:

Remote Section
An up to date list of the available actions can be found in the source code of XBMC in ButtonTranslator.cpp where the TranslateRemoteString function does the work.

Example:

The following buttons are available:

Universal Remote Section
The Xbox uses standard RCA DVD/VCR infrared codes, so if you have a universal remote with a built in device database you can for example use a RCA DVD OFF code to power down the Xbox (this does not require editing the keymap, simply program one of your buttons as RCA DVD off). To map Universal Remote buttons using the RCA infrared protocol, you may add   sections to keymap.xml. In this case, the tags used are  where # is the original button code (OBC) of the button. You would put it inside an section in the or sections.

Example:


 * Will map Stop Playback to the RCA DVD repeat button, which is not used by XBMC by default.


 * Note: ensure that the section is NOT added 'within' the section - it can appear before or after. Otherwise it will not be recognised and produces errors in the logfile.

IMPORTANT: XBMC can be put in a test mode to display the code number read when you press a button on your remote by setting   to true in advancedsettings.xml.

Keyboard Section
Valid keyboard keymap syntax includes, , and.

Mapping for arbitrary key codes can be configured using the following syntax: where "123" is replaced by the key code.

A full list of valid keynames can be found in
 * the TranslateKeyboardString method in ButtonTranslator.cpp
 * or in List of XBMC keynames.

Example:

Custom Joystick Configuration
Custom joysticks are defined using the following syntax:

Getting the joystick name:
 * On linux: 'cat /proc/bus/input/devices'
 * or see your xbmc log file

Getting the button ids:
 * 'id' is the button ID used by SDL. Joystick button ids of connected joysticks appear in xbmc.log when they are pressed. Use your log to map custom buttons to actions.

Example:

Actions
An up to date list of the available actions can be found in the TranslateActionString method in in ButtonTranslator.cpp.

For those debugging integer action codes from the debug log, the mapping of action codes to constants is in Key.h

In addition to the following actions, you can also use the Built-in functions available to FTP, Webserver, skins, keymap and to python in XBMC.