NateTheGreat68 / gamepad-launcher

A simple way to launch an application when a gamepad connects
GNU General Public License v2.0
2 stars 0 forks source link

gamepad-launcher

A simple way to launch an application when a gamepad connects

Overview

Note: as it currently exists, this is written for and only tested on a particular Debian 11 system. It may or may not work on others without modification.

There are three components:

Application service files provided

Installation

Manual installation is as follows:

$ mkdir -p ~/.config/systemd/user
$ cp systemd/* ~/.config/systemd/user/
$ systemctl --user enable <selected_application_service.service>
$ systemctl --user daemon-reload
# cp udev/99-gamepads.rules /etc/udev/rules.d/
# udevadm control --reload

Automatically turning off controllers with xow

Restarting the xow service, if used (to connect Xbox One / Series controllers to the USB wireless dongle), should turn the controllers off. However, restarting the service normally requires root permissions. To get around this, a NOPASSWD line can be added to the sudoers file (or an included file in the appropriate directory). The recommended way is to run sudo visudo /etc/sudoers.d/gamepads and add the following line:

%video ALL = (root) NOPASSWD: /usr/bin/systemctl restart xow

and then any user who is a member of the group "video" should be able to restart xow without a password. Explaining why the visudo command should be used is outside the scope of this README; just know that you risk seriously screwing up your system if you don't.