[HOW TO] Remap Xbox 360 controller buttons in Xubuntu
On a previous article I wrote about using the Xbox 360 controller as a mouse. The --mouse
option is actually a shortcut for a custom button configuration. You can map any button on the controller to any key/combination. In this article I'll layout the basics. Further information can be obtained in the references.
There are two ways of providing a custom mapping:
-
Command line options: use
Example:ui-buttonmap
to map a button and useui-axismap
to map a axis. The syntax consists of assigning a button name to a symbol.ui-buttonmap x=XK_Tab,a=XK_Control_L+XK_a
ui-axismap y2=XK_plus:XK_minus
. This will map "X" as "Tab", "A" as "Super+a" and the right stick up is "+" and right stick down is "-". -
Configuration file: use
config
to provide the path for a configuration file.The config file has a
ini
format. Use the sections ui-buttonmap and ui-axismap for configuring the mappings. You can have a sectionxboxdrv
to provide general options.Example:
[xboxdrv] silent=true trigger-as-button=true dpad-as-button=true [ui-buttonmap] a=XK_Super_L+XK_a b=XK_b x=XK_e y=XK_Shift_L+XK_a
The list of buttons/axis you can map is: a, b, x, y, lb, lt, rb, rt, back, start, du, dd, dl, dr, tl, tr, x1, y1, x2 and y2. These names should be familiar to anyone who knows the controller. tl/tr is pressing the left/right stick and x1/y1 is the axis for the left stick and x2/y2 the axis for the right stick.
A full list of valid symbols can be optained with xboxdrv --help-x11keysym
.
Usage
To provide the mappings directly use: xboxdrv [OPTIONS] --ui-buttonmap BTN=SYM,... -ui-axismap x1=SYM,...
.
To provide a file with the mappings use: xboxdrv [OPTIONS] --config FILENAME
.
You can use the --alt-config and provide alternative configurations. Then you can use the Guide button to change between them. This allows to quickly change mappings without having to rerun the command with a different file. Example: xboxdrv --config first.ini --alt-config second.ini --alt-config third.ini
Comments
Post a Comment