1
0
Fork
You've already forked raylaunch
0
No description
  • C 90.2%
  • Makefile 9.8%
Dhruva Sambrani 3fecc0478b rename binary
2026年05月31日 19:24:14 +02:00
.gitignore rename binary 2026年05月31日 19:24:14 +02:00
config.h rename binary 2026年05月31日 19:24:14 +02:00
daemon.c first commit 2026年05月31日 14:58:42 +02:00
gui.c first commit 2026年05月31日 14:58:42 +02:00
Makefile rename binary 2026年05月31日 19:24:14 +02:00
README.md first commit 2026年05月31日 14:58:42 +02:00

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's evdev interface 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_CLOEXEC to 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

  1. Compile the binary:

    make
    
  2. Install the binary (defaults to /usr/local/bin):

    sudo make install
    

    To customize the directory, specify a custom PREFIX:

    make install PREFIX=$HOME/.local
    
  3. 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.