1.6 KiB
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
- Connects to the Hyprland socket (
.socket2.sock) and listens foractivewindowv2events. - On each window change, it grabs the focused window's class and title via
hyprctl activewindow -j | jq. - If either value matches a configured entry in the
PROFILESassociative array, it activates the corresponding input-remapper preset on your device. - When an unknown window is focused, it deactivates the last active preset.
Uses
input-remapper-controlunder the hood to start/stop presets.
Adding a Game Profile
- Find the window class or title of your game:
- Run
hyprctl clientsand locate the game in the output (class and title are listed for each window)
- Run
- Get the exact name of your input device:
sudo input-remapper-control --list-devices
- Edit
input-remapper-switcher.shand add an entry to thePROFILESarray (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"
)
- If your device is different, update
DEVICE_NAMEon 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.