#!/bin/bash

# omarchy:summary=Install Battle.net via Lutris (Wine + DXVK handled by the Lutris install recipe)
# omarchy:requires-sudo=true

set -e

omarchy-pkg-add lutris umu-launcher wine-staging wine-mono wine-gecko winetricks python-protobuf
omarchy-install-vulkan-lib32
omarchy-install-nvidia-lib32

# Lutris ships with `#!/usr/bin/env python3`, which resolves to mise's Python and
# fails to import the lutris module. Pin the shebang to the system Python.
sudo sed -i '/env python3/ c\#!/bin/python3' /usr/bin/lutris

echo ""
echo "Lutris will open the Battle.net installer. Click Install and follow the prompts."

setsid lutris lutris:install/battlenet >/dev/null 2>&1 &
