|
|
||
|---|---|---|
| .gitignore | rename binary | |
| config.h | rename binary | |
| daemon.c | first commit | |
| gui.c | first commit | |
| Makefile | rename binary | |
| README.md | first commit | |
Gamepad Quick Launcher
This is a minimal, low-overhead Linux gamepad daemon and overlay launcher designed for Wayland and X11 environments.
It runs a headless, event-driven background daemon using the Linux evdev interface to monitor connected controllers. When a configured macro is pressed (default: Left Bumper + Right Bumper), it forks a lightweight visual overlay menu built in C with Raylib, allowing you to select and execute configured system commands.
Note: This project was completely vibe coded.
Architecture & Design
- Headless Background Daemon: Uses
poll()and the Linux kernel'sevdevinterface to monitor raw gamepad inputs. It uses 0% CPU when idle and works globally regardless of window focus or graphical compositor lockouts. - Dynamic Hotplugging: Automatically scans for, attaches to, and cleans up up to 16 gamepads on the fly as they are plugged in or disconnected.
- Wayland-Safe UI: Spawns a temporary, undecorated Raylib overlay window which automatically adapts its dimensions at compile-time to match the size of your config.
- Resource Isolation: The gamepad file descriptors use
O_CLOEXECto ensure background applications launched from the menu do not inherit or lock the raw input streams.
Prerequisites
Dependencies
Ensure you have the Raylib development headers and a C compiler installed on your system:
- Arch Linux:
sudo pacman -S raylib - Debian/Ubuntu:
sudo apt install libraylib-dev - Fedora:
sudo dnf install raylib-devel
Input Permissions
The background daemon needs read access to raw input character devices (/dev/input/event*). To run the program as a normal user, add your user account to the system input group:
sudo usermod -aG input $USER
Note: You must log out and log back in for this group membership change to apply.
Configuration
The application menu and commands are configured inside config.h. Create this file in the project directory before compiling:
// config.h
#ifndef CONFIG_H
#define CONFIG_H
static MenuItem menu_items[] = {
{"Open Firefox", "firefox &"},
{"Open Terminal", "foot &"},
{"Open Steam", "steam &"},
{"Cancel", ""}
};
#endif
Note: Use & at the end of graphical commands to ensure they spawn in the background and let the launcher exit immediately.
Installation & Usage
-
Compile the binary:
make -
Install the binary (defaults to
/usr/local/bin):sudo make installTo customize the directory, specify a custom
PREFIX:make install PREFIX=$HOME/.local -
Run the daemon in the background:
gamepad_launcher &
Controls
- Macro (Global): Press Left Shoulder (LB / L1) and Right Shoulder (RB / R1) together to show the menu.
- Navigate: Use the D-Pad Up / Down (or Analog Stick equivalent mapping) to highlight an option.
- Select: Press Action South (Xbox A / PS Cross) to execute.
- Exit: Press Action East (Xbox B / PS Circle) to dismiss the menu.