Games Hardware

Best Gamepad Mapping Apps for Linux

If you like to play games on Linux with a gamepad instead of a typical keyboard and mouse input system, there are some useful apps for you. Many PC games come without controller support out of the box, mainly because of the nature and the genre of the game. For instance, strategy games require you to micro manage resources and often contain a lot of UI elements and tooltips. Controller support in such cases is the last thing developers would like to add. However, even though the game may not support gamepads, it is possible to add controller support unofficially. This article will list some apps that allow you to remap key bindings to a game controller as well as remap existing gamepad mappings.

QJoyPad

QJoyPad is a free and open source graphical application that allows you to map keyboard and mouse events to a game controller. In simple terms, a Linux game that doesn’t support any or your particular game controller can be made to work with a gamepad using QJoyPad.

Some of the main features of QJoyPad are:

  • Multiple profiles making it easier to manage and switch mappings
  • “Turbo” or “Rapid Fire” button mode
  • Sticky mode for simulating “Press and Hold” behavior
  • Automatically detects gamepad buttons and axes
  • Supports controlling mouse via joysticks
  • Comes with full command line support for those who prefer CLI
  • Support for setting sensitivity of joysticks
  • Comes with many predefined algorithms for controlling mouse cursor sensitivity and acceleration
  • Quick set mode that allows you to detect and set individual keys at the same time

To install QJoyPad in Ubuntu, run the following command:

$ sudo apt install qjoypad

Run command below to launch QJoyPad (or use application launcher):

$ qjoypad

QJoyPad starts minimized to system tray, so you may not see any GUI window until you click on its panel applet. On some desktop environments, system tray is shown but nothing happens when you click on its menu items. To fix this issue, you have to run QJoyPad in non-system-tray mode by running command below:

$ qjoypad --notray

Running QJoyPad without system tray will create a small window containing nothing but icon of the app. If you right click on this icon, all the menu options that are available in the system tray will become visible.

Note that some of the QJoyPad options may not work unless you connect a game controller. To see the gamepad mapping window, double click on the icon shown in the screenshot above.

For QJoyPad mappings to work in a game or app, you will have to keep it running. Be careful not to accidentally close the small window with gamepad icon.

SDL2 Gamepad Tool

SDL2 Gamepad Tool is a free and open source app that allows you to configure game controller buttons using an easy to use graphical interface. As the name suggests, it only works for games that use SDL2 API for controller support (most native Linux games).

Using gamepad mapping database available here, it automatically configures mapping for most controllers. However if your game controller mappings are not shown in the app, you can create new mappings for it by clicking on “Create a New Mapping” button. You can also change pre-defined mappings for any controller using the same process.

Note that this app is not a keyboard-to-joypad mapping utility. It just creates SDL compatible mappings for gamepads so that games using SDL API can automatically pick them.

You can download SDL2 gamepad tool from here.

Once you are satisfied with the mappings, there are two methods you can use to enable them for games. Click on “Set Mapping as Environment Variable” to set these mappings system wide for all games.

The other method is to use these mappings on per game basis. Click on “Copy Mapping String” button then run a command in the following format:

$ SDL_GAMECONTROLLERCONFIG=”paste_here_string_copied_from_method_explained_above”
 /path/to/the/game/executable

For example, the mapping command on my system looks like this:

$ SDL_GAMECONTROLLERCONFIG="050000004c050000cc09000000810000,PS4
Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,
guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,
rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,"
/path/to/the/game/executable

SC Controller

SC Controller is a GTK3 application that allows you to create button mappings for Steam Controller, DualShock 4 gamepad, Xbox controller, and other similar gamepads. The main highlight of this app is its ability to configure advanced gamepad mappings that are equivalent to Steam client’s built-in configuration tool. In simple terms, SC Controller’s user mode driver / GUI app enables configuring gamepads without having a need to install Steam client (no need to have a Steam account as well). Just like QjoyPad, this app allows you to map keyboard and mouse events to a game controller.

Other useful features of SC Controller:

  • Gyroscope configuration support
  • Rapid fire or turbo mode functionality
  • Supports multiple gamepad profiles
  • Vibration / Rumble support
  • Macros and controller emulation
  • Supports on screen keyboard

SC Controller AppImage for Linux distributions can be downloaded from here. Mark the file executable and run it in a terminal or double click the file to start customizing gamepad mappings.

Note that for some reason, SC Controller fails to detect my DualShock 4 controller unless I run it with root access. Most probably because it fails to read input events from the gamepad. A custom udev rule can possibly fix this issue but explaining it here is beyond the scope of this article. If you are having gamepad detection problems with this app, try running it as root.

Conclusion

These are a few apps that can be used to create mappings for your game controller. Most of the well-known game controller brands work out of the box on Linux these days. However unlike console games, PC games rarely provide an option to remap gamepads. The apps mentioned above are especially useful when you are using a generic controller, when you want to alter the layout of existing button mappings, or when you want to map keyboard and mouse events to a game controller.

About the author

Nitesh Kumar

Nitesh Kumar

I am a freelancer software developer and content writer who loves Linux, open source software and the free software community. I maintain a blog that lists new Android deals everyday.