diff --git a/default/hypr/apps/battlenet.lua b/default/hypr/apps/battlenet.lua index 13231d07a29e..5c71a5367720 100644 --- a/default/hypr/apps/battlenet.lua +++ b/default/hypr/apps/battlenet.lua @@ -1,7 +1,13 @@ --- Battle.net launches under Proton; all its windows share class steam_app_battlenet. +-- Battle.net installs standalone under umu-launcher (bin/omarchy-install-gaming-battlenet), +-- so the launcher and each game get their own class: the launcher is battle.net.exe, the +-- installer battle.net-setup.exe. default/applications/battlenet.desktop already records +-- this as StartupWMClass=battle.net.exe. --- The actual launcher: float-centered. -o.window({ class = "^steam_app_battlenet$", title = "^Battle\\.net$" }, { +-- The actual launcher: float-centered. Matched on class alone, because a window rule is +-- applied when the window is mapped and the launcher maps with the title "Battle.net Login", +-- only becoming "Battle.net" after sign-in. Its dialogs (folder pickers, updates) share the +-- class and are better floated too. +o.window({ class = "^battle\\.net\\.exe$" }, { float = true, center = true, size = { 1280, 800 }, @@ -9,7 +15,9 @@ o.window({ class = "^steam_app_battlenet$", title = "^Battle\\.net$" }, { -- Installer: drop decorations and backdrop blur/shadow so the Blizzard chrome -- isn't framed by the WM. -o.window({ class = "^steam_app_battlenet$", title = "^Battle\\.net Setup$" }, { +o.window({ class = "^battle\\.net-setup\\.exe$" }, { + float = true, + center = true, decorate = false, no_blur = true, no_shadow = true, diff --git a/test/shell.d/battlenet-test.sh b/test/shell.d/battlenet-test.sh index dcaa03fea68e..32e5175f8d83 100644 --- a/test/shell.d/battlenet-test.sh +++ b/test/shell.d/battlenet-test.sh @@ -12,3 +12,19 @@ grep -F '$OMARCHY_PATH/default/applications/battlenet.desktop' "$install_script" fail "Battle.net installer installs the launcher from the installer-only template" pass "Battle.net launcher is only installed by the Battle.net installer" + +# The window rules must match the class the standalone install actually produces. +# battlenet.lua used to key on steam_app_battlenet, a class only a Steam-hosted +# install would have, so none of its rules ever applied to Omarchy's own installer. +rules="$ROOT/default/hypr/apps/battlenet.lua" +desktop="$ROOT/default/applications/battlenet.desktop" + +wm_class=$(sed -n 's/^StartupWMClass=//p' "$desktop") +[[ -n $wm_class ]] || fail "battlenet.desktop declares StartupWMClass" + +grep -F "$wm_class" "$rules" >/dev/null || + fail "battlenet.lua matches the class battlenet.desktop declares ($wm_class)" +! grep -F 'steam_app_battlenet' "$rules" >/dev/null || + fail "battlenet.lua no longer matches the Steam-hosted class" + +pass "Battle.net window rules match the class the installer produces"