From 54737695af928226994f2727e50e0c9c1bfba924 Mon Sep 17 00:00:00 2001 From: kenji Date: Wed, 21 Jan 2026 20:02:25 -0600 Subject: [PATCH] feat(gaming): unify and automate game window rules Refactors 'modules/home/gaming.nix' to use a unified 'mkGameRules' function. Applies full gaming rules (monitor 0, workspace gaming, immediate, fullscreen) to: - Steam apps (class:^steam_app_\d+$) - Gamescope, Lutris, Heroic - Wine/Proton windows Preserves manual overrides in the 'games' list. --- modules/home/gaming.nix | 56 ++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/modules/home/gaming.nix b/modules/home/gaming.nix index bbf2e8e..05265db 100644 --- a/modules/home/gaming.nix +++ b/modules/home/gaming.nix @@ -8,22 +8,20 @@ "Deadlock" ]; - # Generate monitor rules for each game in the config - gameRules = - lib.flatten (map (game: [ - "monitor 0, title:^(${game})$" - "workspace name:gaming, title:^(${game})$" - "fullscreen, title:^(${game})$" - "immediate, title:^(${game})$" - "stayfocused, title:^(${game})$" - - "monitor 0, class:^(${game})$" - "workspace name:gaming, class:^(${game})$" - "fullscreen, class:^(${game})$" - "immediate, class:^(${game})$" - "stayfocused, class:^(${game})$" - ]) - games); + mkGameRules = selector: [ + "monitor 0, ${selector}" + "workspace name:gaming, ${selector}" + "fullscreen, ${selector}" + "immediate, ${selector}" + "stayfocused, ${selector}" + ]; + + manualGameRules = lib.flatten (map ( + game: + (mkGameRules "title:^(${game})$") + ++ (mkGameRules "class:^(${game})$") + ) + games); in { home.packages = with pkgs; [ protonup-qt @@ -61,24 +59,20 @@ in { windowrulev2 = [ - # --- STEAM RULES --- + # --- STEAM LAUNCHER RULES --- "workspace special:steam silent, class:^(steam)$" "noinitialfocus, class:^(steam)$" "suppressevent activate, class:^(steam)$" - - # --- GAMING RULES --- - "fullscreen, class:^steam_app_\d+$" - "monitor 0, class:^steam_app_\d+$" - "workspace name:gaming, class:^steam_app_\d+$" - "immediate, class:^steam_app_\d+$" - "stayfocused, class:^steam_app_\d+$" - - "fullscreen, class:^(gamescope)$" - "fullscreen, class:^(lutris)$" - "fullscreen, class:^(heroic)$" - "fullscreen, class:^wine-.*$" - "fullscreen, title:^Wine .*$" ] - ++ gameRules; + # --- AUTO-DETECTED GAMES --- + ++ (mkGameRules "class:^steam_app_\\d+$") + ++ (mkGameRules "class:^(gamescope)$") + ++ (mkGameRules "class:^(lutris)$") + ++ (mkGameRules "class:^(heroic)$") + ++ (mkGameRules "class:^wine-.*$") + ++ (mkGameRules "title:^Wine .*$") + # --- MANUAL GAMES --- + ++ manualGameRules; }; } +