Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions default/hypr/apps/battlenet.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
-- 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 },
})

-- 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,
Expand Down
16 changes: 16 additions & 0 deletions test/shell.d/battlenet-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"