Add Battle.net installer

This commit is contained in:
Ryan Hughes
2026-05-19 14:09:04 -04:00
parent a157b98d5b
commit b59a8d0bb0
7 changed files with 210 additions and 3 deletions
+91
View File
@@ -0,0 +1,91 @@
#!/bin/bash
# omarchy:summary=Install Battle.net standalone via umu-launcher + GE-Proton (no Steam, no Lutris, no Heroic).
# omarchy:requires-sudo=true
set -e
PREFIX="$HOME/Games/battlenet"
LAUNCHER="$PREFIX/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe"
INSTALLER_URL="https://downloader.battle.net/download/getInstallerForGame?os=win&gameProgram=BATTLENET_APP&version=Live"
echo "Installing Battle.net..."
omarchy-pkg-add umu-launcher
omarchy-install-gaming-gpu-lib32
# Detect a half-finished prefix from a closed/crashed previous run and offer
# to wipe it before trying again. Battle.net's installer isn't idempotent.
if [[ -d $PREFIX && ! -f $LAUNCHER ]]; then
echo
echo "Found a partial Battle.net install at $PREFIX (no Launcher.exe)."
echo "Battle.net's installer can't resume from this state."
if gum confirm "Wipe the partial prefix and start fresh?"; then
pkill -f "$PREFIX" 2>/dev/null || true
sleep 1
rm -rf "$PREFIX"
else
echo "Aborting. Re-run when ready to wipe."
exit 1
fi
fi
mkdir -p "$PREFIX"
export WINEPREFIX="$PREFIX"
export PROTONPATH=GE-Proton
export GAMEID=umu-battlenet
export PROTON_VERB=run
if [[ -f "$LAUNCHER" ]]; then
echo "Battle.net is already installed at $PREFIX."
launched_installer=0
else
cache_dir="$HOME/.cache/omarchy"
mkdir -p "$cache_dir"
installer="$cache_dir/Battle.net-Setup.exe"
echo
echo "Downloading Battle.net installer..."
curl --fail --location --retry 3 "$INSTALLER_URL" --output "$installer"
cat <<'EOF'
Launching the Battle.net setup wizard. Click through it normally — the
default install path is fine. When it finishes, Battle.net will be in your
app launcher.
EOF
log="/tmp/omarchy-battlenet-installer.log"
setsid -f sh -c "umu-run '$installer' >'$log' 2>&1" </dev/null >/dev/null 2>&1
echo "Installer log: $log"
launched_installer=1
fi
mkdir -p "$HOME/.local/share/applications" "$HOME/.local/share/icons/hicolor/48x48/apps"
install -m 644 "$HOME/.local/share/omarchy/applications/battlenet.desktop" \
"$HOME/.local/share/applications/battlenet.desktop"
install -m 644 "$HOME/.local/share/omarchy/applications/icons/Battle.net.png" \
"$HOME/.local/share/icons/hicolor/48x48/apps/Battle.net.png"
gtk-update-icon-cache "$HOME/.local/share/icons/hicolor" &>/dev/null || true
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
if (( launched_installer )); then
cat <<EOF
The Battle.net installer is running in the background. After it finishes,
find Battle.net in your app launcher, or run:
omarchy-launch-battlenet
EOF
else
cat <<EOF
Battle.net is installed. Find it in your app launcher, or run:
omarchy-launch-battlenet
EOF
fi
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# omarchy:summary=Launch the installed Battle.net client via umu-launcher + GE-Proton.
# omarchy:args=[--with-mangohud]
# omarchy:examples=omarchy launch battlenet | omarchy launch battlenet --with-mangohud
set -e
PREFIX="$HOME/Games/battlenet"
LAUNCHER="$PREFIX/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe"
with_mangohud=0
for arg in "$@"; do
case "$arg" in
--with-mangohud) with_mangohud=1 ;;
-h|--help)
cat <<'EOF'
Usage: omarchy-launch-battlenet [--with-mangohud]
Options:
--with-mangohud Enable the MangoHud FPS overlay for games launched from
Battle.net. Toggle perf logging in-game with Shift_L+F2;
CSV logs land in ~/mangohud/.
EOF
exit 0
;;
*)
echo "Unknown argument: $arg" >&2
echo "Try: omarchy-launch-battlenet --help" >&2
exit 1
;;
esac
done
if [[ ! -f "$LAUNCHER" ]]; then
echo "Battle.net is not installed. Run omarchy-install-gaming-battlenet first." >&2
exit 1
fi
env_args=(
WINEPREFIX="$PREFIX"
PROTONPATH=GE-Proton
GAMEID=umu-battlenet
PROTON_VERB=run
)
(( with_mangohud )) && env_args+=(MANGOHUD=1)
env "${env_args[@]}" umu-run "$LAUNCHER"
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# omarchy:summary=Remove Battle.net, its Proton prefix, installed games, and desktop entry.
set -e
PREFIX="$HOME/Games/battlenet"
# Stop any running Battle.net / wine processes tied to this prefix.
pkill -f "$PREFIX" 2>/dev/null || true
sleep 1
rm -rf "$PREFIX"
rm -f "$HOME/.local/share/applications/battlenet.desktop"
rm -f "$HOME/.local/share/icons/hicolor/48x48/apps/Battle.net.png"
rm -f "$HOME/.cache/omarchy/Battle.net-Setup.exe"
gtk-update-icon-cache "$HOME/.local/share/icons/hicolor" &>/dev/null || true
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
echo
echo "Battle.net and its Proton prefix at $PREFIX have been removed."
if omarchy-pkg-present umu-launcher; then
echo
read -rp "Also remove umu-launcher? It's only used by this command. [y/N] " reply
if [[ $reply =~ ^[Yy]$ ]]; then
omarchy-pkg-drop umu-launcher
fi
fi
PROTON_DIR="$HOME/.local/share/Steam/compatibilitytools.d"
if compgen -G "$PROTON_DIR/GE-Proton*" >/dev/null; then
echo
read -rp "Also remove GE-Proton runtimes downloaded by umu? [y/N] " reply
if [[ $reply =~ ^[Yy]$ ]]; then
rm -rf "$PROTON_DIR"/GE-Proton*
rm -rf "$HOME/.local/share/umu"
fi
fi