From dca67e19bcbafa42fd6a1ebd8a6c7536ee1e31ef Mon Sep 17 00:00:00 2001 From: kenji Date: Sat, 14 Mar 2026 07:54:19 -0500 Subject: [PATCH] fix(gaming): now only stay focus on selected games an issue in `Deadlock` does not focus its mouse even when the player is not in the menu --- modules/home/gaming.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/home/gaming.nix b/modules/home/gaming.nix index 5d6c535..e92969e 100644 --- a/modules/home/gaming.nix +++ b/modules/home/gaming.nix @@ -10,12 +10,18 @@ "citadel" ]; + # Games that should have `stayfocused` applied (to avoid multi-monitor focus issues) + stayFocusedGames = [ + "Deadlock" + "project8" + "citadel" + ]; + mkGameRules = selector: [ "monitor 0, ${selector}" "workspace name:gaming, ${selector}" "fullscreen, ${selector}" "immediate, ${selector}" - "stayfocused, ${selector}" ]; manualGameRules = lib.flatten (map ( @@ -24,6 +30,14 @@ ++ (mkGameRules "class:^(${game})$") ) games); + + stayFocusedRules = lib.flatten (map ( + game: [ + "stayfocused, title:^(${game})$" + "stayfocused, class:^(${game})$" + ] + ) + stayFocusedGames); in { home.packages = with pkgs; [ protonup-qt @@ -74,6 +88,8 @@ in { ++ (mkGameRules "class:^wine-.*$") ++ (mkGameRules "title:^Wine .*$") # --- MANUAL GAMES --- - ++ manualGameRules; + ++ manualGameRules + # --- STAYFOCUSED FOR SELECTED GAMES --- + ++ stayFocusedRules; }; }