antimicro is a graphical program used to map keyboard keys and mouse controls to a gamepad. This program is useful for playing PC games using a gamepad that do not have any form of built-in gamepad support. However, you can use this program to control any desktop application (while running an X11 environment) with a gamepad.
https://github.com/AntiMicro/antimicro-profiles is a repository for pre-made antimicro profiles, providing convenience controller layouts suitable for playing a game without having to map everything yourself.
Use evtest, or perhaps jstest from the joystick package, if you encounter problems detecting a controller, axes or buttons.