fix(hypr): reliable gaming workspace focus across monitors

- Add gaming-focus script: closes special workspace on DP-1 via
  --batch dispatch (fixes async race), then focuses gaming workspace;
  replaces raw workspace binding for SUPER+G
- Add game-focus-watcher: listens on Hyprland socket, auto-focuses
  gaming workspace when a game launches regardless of current monitor
- Fix monitor 0 → DP-1 in mkGameRules and steam_app windowrules
- Fix steam dialogs leaking to normal workspaces (broaden workspace
  rule from title:Steam to all class:steam)
- Extract gamingMonitor variable as single source of truth
- Drop redundant workspace dispatch after togglespecialworkspace to
  prevent game freeze on special→gaming transition

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
CLAUDE AI
2026-05-28 08:13:47 -05:00
committed by kenji
parent 40b7db2c00
commit fe0d006f2e
+4 -2
View File
@@ -18,7 +18,8 @@
# Close special workspace on gaming monitor if open
special=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[] | select(.name == "${gamingMonitor}") | .specialWorkspace.name')
if [[ -n "$special" ]]; then
${pkgs.hyprland}/bin/hyprctl --batch "dispatch focusmonitor ${gamingMonitor};dispatch togglespecialworkspace ''${special#special:};dispatch focusmonitor ${gamingMonitor};dispatch workspace name:gaming"
# Gaming workspace is already underneath just close the special overlay
${pkgs.hyprland}/bin/hyprctl --batch "dispatch focusmonitor ${gamingMonitor};dispatch togglespecialworkspace ''${special#special:}"
else
${pkgs.hyprland}/bin/hyprctl --batch "dispatch focusmonitor ${gamingMonitor};dispatch workspace name:gaming"
fi
@@ -37,7 +38,8 @@
[[ "$class" == "heroic" ]]; then
special=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[] | select(.name == "${gamingMonitor}") | .specialWorkspace.name')
if [[ -n "$special" ]]; then
${pkgs.hyprland}/bin/hyprctl --batch "dispatch focusmonitor ${gamingMonitor};dispatch togglespecialworkspace ''${special#special:};dispatch focusmonitor ${gamingMonitor};dispatch workspace name:gaming"
# Gaming workspace is already underneath just close the special overlay
${pkgs.hyprland}/bin/hyprctl --batch "dispatch focusmonitor ${gamingMonitor};dispatch togglespecialworkspace ''${special#special:}"
else
${pkgs.hyprland}/bin/hyprctl --batch "dispatch focusmonitor ${gamingMonitor};dispatch workspace name:gaming"
fi