Files
scripts/system/input-remapper-switcher/README.md
T

1.6 KiB

input-remapper-switcher

Automatically switches input-remapper presets on a per-game (or per-app) basis when used with the Hyprland window manager.

How It Works

  1. Connects to the Hyprland socket (.socket2.sock) and listens for activewindowv2 events.
  2. On each window change, it grabs the focused window's class and title via hyprctl activewindow -j | jq.
  3. If either value matches a configured entry in the PROFILES associative array, it activates the corresponding input-remapper preset on your device.
  4. When an unknown window is focused, it deactivates the last active preset.

Uses input-remapper-control under the hood to start/stop presets.

Adding a Game Profile

  1. Find the window class or title of your game:
    • Run hyprctl clients and locate the game in the output (class and title are listed for each window)
  2. Get the exact name of your input device:
    • sudo input-remapper-control --list-devices
  3. Edit input-remapper-switcher.sh and add an entry to the PROFILES array (line 6):
declare -A PROFILES=(
    ["Grand Theft Auto V"]="GTA"
    ["steam_app_1151340"]="Fallout"
    ["steam_app_1203620"]="Enshrouded"
    # Add yours here:
    ["Your Window Class or Title"]="Your Preset Name"
)
  1. If your device is different, update DEVICE_NAME on line 13:
DEVICE_NAME="Your Device Name"

Usage

Run the script manually or launch it at Hyprland startup (e.g., in hyprland.conf):

exec-once = ~/.config/hypr/scripts/input-remapper-switcher.sh

The script runs in the foreground listening for events — it does not daemonize on its own.