|
| 1 | +# hypr_steam_watcher |
| 2 | +<!-- [](https://aur.archlinux.org/packages/hypr_steam_watcher-git) --> |
| 3 | +<!-- [](https://github.com/LennardKittner/hypr_steam_watcher/releases) --> |
| 4 | +<!-- [](https://github.com/LennardKittner/hypr_steam_watcher/releases) --> |
| 5 | +Automatically tags newly launched Steam games in Hyprland so you can target or exclude them in window rules without manual configuration. |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + <img src="screenshot/image.png" width="700"> |
| 9 | + <br> |
| 10 | + <em>VA-11 Hall-A tagged with steam_game and steam_app_id_447530</em> |
| 11 | +</p> |
| 12 | + |
| 13 | +`hypr_steam_watcher` listens for newly created windows in Hyprland and automatically tags Steam game windows with `steam_game` and `steam_app_id_<game-id>`. |
| 14 | +This allows you to exclude Steam games from certain window rules or define specific window rules that only apply to Steam games. |
| 15 | +``` |
| 16 | +windowrule = match:class .*, match:tag negative:steam_game, opacity 0.9 # everything except steam games is transparent |
| 17 | +windowrule = match:tag steam_game,opacity no_blur # disable blur for steam games |
| 18 | +windowrule = match:class .*, match:tag steam_app_id_12345, workspace 3 # launch window for the steam game with app ID 12345 on workspace 3 |
| 19 | +``` |
| 20 | + |
| 21 | +## Compatibility |
| 22 | +The app works with both native Linux and Proton games. |
| 23 | + |
| 24 | +## Requirements |
| 25 | +- Hyprland (Wayland compositor) |
| 26 | +- Steam |
| 27 | +- Rust (only if building from source) |
| 28 | + |
| 29 | +## Installation |
| 30 | + |
| 31 | +### Release |
| 32 | +You can download a prebuilt version from the [releases](https://github.com/LennardKittner/hypr_steam_watcher/releases). |
| 33 | +Then add `exec-once = hypr_steam_watcher` to your `hyprland.conf` to start it automatically. |
| 34 | + |
| 35 | +### Build from Source |
| 36 | +You can build the project from source using cargo: |
| 37 | +```bash |
| 38 | +git clone https://github.com/LennardKittner/hypr_steam_watcher.git |
| 39 | +cd hypr_steam_watcher |
| 40 | +cargo build --release |
| 41 | +sudo cp target/release/hypr_steam_watcher /usr/bin/ |
| 42 | +``` |
| 43 | +Then add `exec-once = hypr_steam_watcher` to your `hyprland.conf` |
| 44 | + |
| 45 | +## Usage |
| 46 | +``` |
| 47 | +hypr_steam_watcher --help |
| 48 | +Automatically tag newly launched Steam games in Hyprland. |
| 49 | +
|
| 50 | +Usage: hypr_steam_watcher [callback] [callback-arguments]... |
| 51 | +
|
| 52 | +Arguments: |
| 53 | + [callback] A callback that will be called when a new window of a steam game appears |
| 54 | + [callback-arguments]... Arguments for the callback. The PID and Steam app ID will be appended to the arguments. |
| 55 | +
|
| 56 | +Options: |
| 57 | + -h, --help Print help |
| 58 | + -V, --version Print version |
| 59 | +``` |
| 60 | +Running `hypr_steam_watcher` without any arguments will tag any Steam games launched while this app is running. |
| 61 | + |
| 62 | +It is also possible to provide a callback, e.g., `hypr_steam_watcher echo game:` or `hypr_steam_watcher ./activate_game_mod.sh`. |
| 63 | +hypr_steam_watcher will call the callback in a non-blocking way whenever a new Steam game starts and appends the PID and Steam app ID of the newly executed game to the parameters for the callback. |
| 64 | +Thus, `hypr_steam_watcher echo game:` will print `game: <pid> <steam_app_id>` once to the console every time a new Steam game is launched. |
| 65 | +You can also run more complex expressions like `hypr_steam_watcher bash -c 'sleep 2 && echo game: "$0 $1"'` this will also print `game: <pid> <steam_app_id>` after a two-second delay. |
| 66 | + |
| 67 | +### Callback Arguments |
| 68 | + |
| 69 | +The callback receives: |
| 70 | + |
| 71 | +<callback> [callback-arguments...] <pid> <steam_app_id> |
| 72 | + |
| 73 | +## Use Cases |
| 74 | +- Disable blur or transparency for games |
| 75 | +- Automatically move games to a dedicated workspace |
| 76 | +- Enable performance scripts automatically |
| 77 | +- Apply per-game rules using Steam App IDs |
| 78 | + |
| 79 | +## How it works |
| 80 | +- Uses the hyprland crate to detect new windows |
| 81 | +- Gets the PID |
| 82 | +- Checks whether the environment of the process contains `SteamAppId` |
| 83 | +- Uses the hyprland crate to tag the window |
| 84 | +- Executes the callback (if provided) |
| 85 | + |
| 86 | +## Troubleshooting |
| 87 | +- Ensure hypr_steam_watcher is running |
| 88 | +- Start it before launching the game |
| 89 | + |
| 90 | +If a game is not tagged correctly, please open an issue and include: |
| 91 | +- Game name |
| 92 | +- Native or Proton |
| 93 | +- Output of `hyprctl activewindow` |
| 94 | + |
| 95 | +## License |
| 96 | +MIT see LICENSE file |
0 commit comments