Skip to content

ericlathrop/xjoy2key

Repository files navigation

xjoy2key 0.1.0

Copyright 2010 Eric Lathrop <eric@ericlathrop.com>

xjoy2key is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

xjoy2key is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with xjoy2key.  If not, see <http://www.gnu.org/licenses/>.


What is xjoy2key?
=================
xjoy2key maps your joystick button presses to keyboard key presses so you can
play games with a joystick that don't support one natively.


Setup and usage
===============
The first time you run xjoy2key you'll need to have it generate a configuration
file for you to edit. Plug in your joystick and run:

  xjoy2key --config /dev/input/js0 >somegame.cfg

where js0 is the device name of your joystick. Edit the file generated to change
which keyboard keys are sent for each button or axis. The line:

  axis -3 Left -32767

sets the negative end of the 3rd axis to send the keyboard's left arrow when it
reaches a value of -32767 or lower. The line:

  button 2 Shift_L

sets the 2nd button to send the keyboard's left shift key when it is pressed.
Use the jscal program to identify the buttons and axes on your joystick. (Mine
reported several phantom axes and buttons that didn't exist). Look in
/usr/include/X11/keysymdef.h to find the names of the keys you can use.

Once your configuration file is set up, run:

  xjoy2key somegame.cfg

You should be able to test your configuration by opening a text editor and
pressing joystick buttons to make sure the right keys are sent.

That's it! Have fun playing your games!

About

Maps joystick button presses into X11 keyboard key presses

Resources

License

Stars

Watchers

Forks

Packages

No packages published