How to map keyboard keys to joystick buttons using joy2key?
There isn't much documentation on the game I'm playing using WINE, and it doesn't detect a joystick. I want to use joy2key
to map keyboard keys to joystick buttons, but can't figure out exactly how to use its command line interface.
joy2key -dev /dev/input/js0 -terminal
That command shows what to press, but I can't figure out how to map the keys since the instructions are not clear.
Solution 1:
You can use antimicro
, it is a fork of joy2key
and has a GUI
, use this PPA
for 12.04 to 15.10
sudo add-apt-repository ppa:ryochan7/antimicro
sudo apt-get update
sudo apt-get install antimicro
For 16.04 to 17.10 use this PPA
sudo add-apt-repository ppa:mdeguzis/libregeek
sudo apt-get update
sudo apt-get install antimicro
Source
Solution 2:
For those looking for a solution that's easily installable on Ubuntu 18.04+, I found qjoypad
in the official Ubuntu repositories. Install it like this:
sudo apt install qjoypad
Then, it should be available in your launcher. It starts as a system tray icon, and you can launch the configurator by right clicking on it.
Personally, I really like the quick bind option that lets you press a key on a gamepad and then a key on your keyboard to update the mapping for that layout automatically. Note that it does indeed natively support multiple gamepads.
For me, I had some trouble with getting the right click to launch the configurator to work on the Unity 7.5 desktop - and the left-click menu doesn't appear to have an option for launching it. Thankfully, there's a workaround for this too. Simply launch qjoypad
like so:
qjoypad --notray
....this will disable the system tray icon and instead launch a window with the icon in it instead - which works as expected.
This can be made to happen automatically by editing /usr/share/applications/qjoypad.desktop
. Find the line that starts with Exec=
, and append --notray
to the end of it (make sure that there's a space after qjoypad
at the end of the line and --notray
).