A Go CLI tool to install, manage, and run [Battle.net](https://battle.net) on Linux via [wine-cachyos](https://github.com/CachyOS/wine-cachyos).
4
-
5
-
Built for **Wayland** tiling WMs such as niri and Hyprland. Native Wayland is the default, with an explicit X11/XWayland mode for compatibility. Automatic GPU detection supports AMD, NVIDIA, and Intel.
6
-
7
-
## Dependencies
8
-
9
-
**CachyOS** (all packages available in the CachyOS repos):
10
-
11
-
```bash
12
-
# Required — optimized Wine installed under /opt/wine-cachyos
13
-
sudo pacman -S wine-cachyos-opt
14
-
15
-
# Required — DXVK/VKD3D translate Direct3D to Vulkan (critical for frame pacing)
# Optional — extracts Battle.net icon for the .desktop entry
19
-
sudo pacman -S icoutils
20
-
```
21
-
22
-
**Arch Linux** (non-CachyOS): `wine-cachyos` requires the [CachyOS repositories](https://wiki.cachyos.net/adding_repo/). The closest alternative is `wine-tkg-git` (AUR) — untested.
3
+
Install, manage, and run [Battle.net](https://battle.net) on Linux via Wine.
4
+
Native Wayland is the default; X11/XWayland is available for compatibility.
5
+
GPU-specific settings are applied automatically for AMD, NVIDIA, and Intel.
6
+
7
+
## Requirements
8
+
9
+
- Wine, **>= 11.19 for Wayland**. On Arch Linux, install either:
10
+
```bash
11
+
sudo pacman -S wine-staging
12
+
# Or: sudo pacman -S wine
13
+
```
14
+
- Vulkan drivers for your GPU, plus DXVK and VKD3D-proton package data.
15
+
On CachyOS these are available as `dxvk-mingw-git` and
16
+
`vkd3d-proton-mingw-git`; other distributions may package them differently.
17
+
- Optional: `icoutils` to extract the Battle.net icon for desktop entries.
18
+
- Optional: CachyOS Wine installed at `/opt/wine-cachyos` as a fallback.
23
19
24
20
## Install
25
21
22
+
With Go installed:
23
+
26
24
```bash
27
25
go install github.com/bnema/bnetctl@latest
28
26
```
29
27
28
+
Make sure your Go binary directory (usually `~/go/bin`) is on `PATH`.
bnetctl desktop add # Add Wayland and X11 menu entries
39
+
bnetctl desktop remove # Remove menu entries
40
+
bnetctl kill # Stop Battle.net and leftover Wine processes
41
+
bnetctl stop # Alias for kill
42
+
bnetctl clean # Remove cache and prefix
43
+
bnetctl clean -a # Also remove desktop entries and data
42
44
```
43
45
44
-
## What it does
46
+
### Wine selection
45
47
46
-
- Prefers `/opt/wine-cachyos/bin/wine`; in Wayland mode, prefers Wine >= 11.19, falling back to `wine` on PATH when necessary. `BNETCTL_WINE` always wins
47
-
- Creates a Wine prefix with DXVK + VKD3D-proton auto-installed
48
-
- Downloads and runs the official Battle.net installer
49
-
- Uses native Wayland by default for both `install` and `launch`, with `--display-driver x11` available for XWayland
50
-
- Sets up NTSync (auto-detected), esync/fsync, GPU-specific env vars
**Maintenance limitation:** `-r` skips Run keys and Startup, but Wine still
92
-
processes RunServicesOnce and HKLM RunOnce (`programs/wineboot/wineboot.c`,
93
-
lines 1931 and 1945; Run/Startup are gated at 1947–1952). Before maintenance,
94
-
bnetctl reads `pfx/system.reg` and `pfx/user.reg` and refuses if RunOnce or
95
-
RunServicesOnce, including Wow6432Node variants, contains any values. The error
96
-
lists the entries. bnetctl never deletes or disables these registry values.
97
-
Resolve pending one-time startup tasks yourself before retrying maintenance.
98
-
99
-
The `prefix/wine-version` marker is committed only after verification. A
100
-
`prefix/wine-version.migrating` record is written before updating; failures
101
-
retain it and force a retry, even if the committed version already matches.
102
-
Both records establish a minimum Wine version: X11 and Wayland will use an
103
-
available runtime at least that new, or refuse. An older explicit `BNETCTL_WINE`
104
-
is rejected rather than silently overridden. Switching display modes never
105
-
downgrades a tracked prefix. Version probes (`wine --version`) may run during
106
-
selection; downgrade refusals run no prefix Wine commands.
107
-
108
-
An exclusive `prefix/.bnetctl.lock` protects selection and maintenance until the
109
-
application process starts; concurrent invocations fail immediately. Close
110
-
Battle.net and all its games before switching Wine versions. The first update
111
-
may take longer. The default prefix is `~/.local/share/bnetctl/prefix`.
112
-
113
-
Use `bnetctl --verbose launch --display-driver wayland` to see the selected Wine,
114
-
HDR policy, and any one-time prefix update on stderr. Logs are always saved to
115
-
`~/.cache/bnetctl/bnetctl.log` (or the corresponding XDG cache directory).
66
+
## Troubleshooting
67
+
68
+
- **Wayland rendering or login problems:** try `--display-driver x11` and check
69
+
your Wine version and Vulkan drivers.
70
+
- **Wine version changes:** close Battle.net and its games before switching.
71
+
bnetctl updates the prefix and verifies graphics DLLs when needed. Pending
72
+
RunOnce/RunServicesOnce tasks can block maintenance; resolve the reported
73
+
tasks before retrying. Stop and clean do not run migration preflight.
74
+
- **Prefix busy:** maintenance, shutdown, and deletion share an exclusion lock.
75
+
Stop/clean wait up to 10 seconds for the lock; retry after maintenance finishes.
76
+
Launch releases its lock once Wine starts, not at the end of the game session.
77
+
- **More detail:** run `bnetctl --verbose launch` to see runtime selection and
78
+
maintenance diagnostics. Logs are saved to `~/.cache/bnetctl/bnetctl.log`.
116
79
117
80
## Directories
118
81
119
-
| Type | Path |
120
-
|------|------|
82
+
Paths are based on your home directory; `XDG_DATA_HOME` and `XDG_CACHE_HOME`
83
+
are not currently honored. Full cleanup retains the data directory and its
84
+
`prefix.lock` file so concurrent invocations keep using the same lock inode.
85
+
86
+
| Type | Default path |
87
+
|------|--------------|
121
88
| Data | `~/.local/share/bnetctl` |
122
-
| Cache | `~/.cache/bnetctl` |
123
89
| Prefix | `~/.local/share/bnetctl/prefix` |
90
+
| Cache | `~/.cache/bnetctl` |
124
91
| Log | `~/.cache/bnetctl/bnetctl.log` |
125
92
126
93
## License
@@ -1,126 +1,93 @@
1
# bnetctl
1
# bnetctl
2
2
3
-
A Go CLI tool to install, manage, and run [Battle.net](https://battle.net) on Linux via [wine-cachyos](https://github.com/CachyOS/wine-cachyos).
3
+
Install, manage, and run [Battle.net](https://battle.net) on Linux via Wine.
4
-
4
+
Native Wayland is the default; X11/XWayland is available for compatibility.
5
-
Built for **Wayland** tiling WMs such as niri and Hyprland. Native Wayland is the default, with an explicit X11/XWayland mode for compatibility. Automatic GPU detection supports AMD, NVIDIA, and Intel.
5
+
GPU-specific settings are applied automatically for AMD, NVIDIA, and Intel.
6
-
6
+
7
-
## Dependencies
7
+
## Requirements
8
-
8
+
9
-
**CachyOS** (all packages available in the CachyOS repos):
9
+
- Wine, **>= 11.19 for Wayland**. On Arch Linux, install either:
10
-
10
+
```bash
11
-
```bash
11
+
sudo pacman -S wine-staging
12
-
# Required — optimized Wine installed under /opt/wine-cachyos
12
+
# Or: sudo pacman -S wine
13
-
sudo pacman -S wine-cachyos-opt
13
+
```
14
-
14
+
- Vulkan drivers for your GPU, plus DXVK and VKD3D-proton package data.
15
-
# Required — DXVK/VKD3D translate Direct3D to Vulkan (critical for frame pacing)
15
+
On CachyOS these are available as `dxvk-mingw-git` and
`vkd3d-proton-mingw-git`; other distributions may package them differently.
17
-
17
+
- Optional: `icoutils` to extract the Battle.net icon for desktop entries.
18
-
# Optional — extracts Battle.net icon for the .desktop entry
18
+
- Optional: CachyOS Wine installed at `/opt/wine-cachyos` as a fallback.
19
-
sudo pacman -S icoutils
20
-
```
21
-
22
-
**Arch Linux** (non-CachyOS): `wine-cachyos` requires the [CachyOS repositories](https://wiki.cachyos.net/adding_repo/). The closest alternative is `wine-tkg-git` (AUR) — untested.
23
19
24
## Install
20
## Install
25
21
22
+
With Go installed:
23
+
26
```bash
24
```bash
27
go install github.com/bnema/bnetctl@latest
25
go install github.com/bnema/bnetctl@latest
28
```
26
```
29
27
28
+
Make sure your Go binary directory (usually `~/go/bin`) is on `PATH`.
bnetctl desktop remove # Remove .desktop menu entry
38
+
bnetctl desktop add # Add Wayland and X11 menu entries
39
-
bnetctl kill # Stop Battle.net, including leftover Wine processes
39
+
bnetctl desktop remove # Remove menu entries
40
-
bnetctl clean # Remove cache and prefix
40
+
bnetctl kill # Stop Battle.net and leftover Wine processes
41
-
bnetctl clean -a # Full purge (cache, prefix, desktop entry, data)
41
+
bnetctl stop # Alias for kill
42
+
bnetctl clean # Remove cache and prefix
43
+
bnetctl clean -a # Also remove desktop entries and data
42
```
44
```
43
45
44
-
## What it does
46
+
### Wine selection
45
47
46
-
- Prefers `/opt/wine-cachyos/bin/wine`; in Wayland mode, prefers Wine >= 11.19, falling back to `wine` on PATH when necessary. `BNETCTL_WINE` always wins
48
+
1. `BNETCTL_WINE`, when set, selects the Wine executable for every display mode.
47
-
- Creates a Wine prefix with DXVK + VKD3D-proton auto-installed
49
+
2. Otherwise, use `wine` on `PATH`, falling back to `/opt/wine-cachyos/bin/wine`.
48
-
- Downloads and runs the official Battle.net installer
50
+
3. A tracked prefix requires Wine at least as new as its recorded version, including for stop; an older explicit override is rejected.
49
-
- Uses native Wayland by default for both `install` and `launch`, with `--display-driver x11` available for XWayland
51
+
4. `wineboot` and `wineserver` must be beside the resolved Wine binary; Wayland warns below 11.19.
50
-
- Sets up NTSync (auto-detected), esync/fsync, GPU-specific env vars