Three UX fixes for the tray's profile-switch flow:
* Optimistic Connecting paint when switching from Connected/Connecting.
Previously the daemon's Down step emitted Idle before the new
profile's Up emitted Connecting, leaving the tray flashing
"Disconnected" for the duration of the Down. switchProfile now sets a
flag and synthesizes a Connecting paint at click time; applyStatus
suppresses the transient Idle and the stale Connected updates that
arrive during the old profile's teardown, clearing the flag only when
the new profile's flow surfaces (Connecting, NeedsLogin, LoginFailed,
SessionExpired, DaemonUnavailable, or a 30s safety timeout).
* Disconnect during an in-flight switch now actually disconnects. The
switchCancel context cancels the ProfileSwitcher.SwitchActive
goroutine so its queued Up RPC never fires, and the
switchInProgress flag is cleared so the daemon's Idle push paints
through immediately. Without this, the user's Disconnect click was
followed seconds later by the switcher's Up bringing the new
profile back online.
* The first menu row is informational only. SetEnabled(false) is
re-applied to t.statusItem (initial build, applyStatus, and the
optimistic paint) and the openRoute("/login") OnClick handler is
dropped — every actionable transition flows through the
Connect/Disconnect entries below.
The switchProfile and applyStatus godocs carry the full
prevStatus → suppressed-events / final-state transition tables so
future readers don't have to rebuild the policy from the code.
NetBird desktop UI (Wails3 + React)
Replaces client/ui (Fyne). One binary on Windows / macOS / Linux,
talks to the NetBird daemon over gRPC, renders a React frontend in a
WebView.
Prerequisites
- Go ≥ 1.25, Node ≥ 20, pnpm (
corepack enable && corepack prepare pnpm@latest --activate) wails3CLI:go install github.com/wailsapp/wails/v3/cmd/wails3@latesttask:go install github.com/go-task/task/v3/cmd/task@latest- A running NetBird daemon (default:
unix:///var/run/netbird.sock, Windowstcp://127.0.0.1:41731) - Linux only:
libwebkit2gtk-4.1-dev,libgtk-3-dev,libayatana-appindicator3-dev
Develop without rebuilding
cd client/ui
task dev
task dev runs Vite (port 9245) + the Go binary + a *.go watcher.
Frontend edits hot-reload instantly. Go edits trigger a rebuild and
relaunch. Pass daemon flags after --:
task dev -- --daemon-addr=tcp://127.0.0.1:41731
For pure UI work (no native window, fastest loop):
cd frontend && pnpm dev
Production build
task build
Output in bin/. Frontend assets are embedded into the binary.
Cross-compile Windows from Linux
Install the mingw-w64 toolchain once:
sudo apt install gcc-mingw-w64-x86-64 # Debian/Ubuntu
sudo dnf install mingw64-gcc # Fedora
sudo pacman -S mingw-w64-gcc # Arch
Then:
CGO_ENABLED=1 task windows:build
Produces bin/netbird-ui.exe. macOS cross-compile from Linux is not
supported (signing and notarization need a real Mac).
Windows console build (logs in the terminal)
Default windows:build links the binary as a Windows GUI app, which
detaches from the launching console — logrus output, fmt.Println,
and panics go nowhere visible. To debug tray/event/daemon issues:
CGO_ENABLED=1 task windows:build:console
Produces bin/netbird-ui-console.exe. Run it from cmd.exe /
PowerShell / Windows Terminal and stdout/stderr land in that
terminal. Same flag works on a native Windows build (drop the
CGO_ENABLED=1 if your toolchain already has it set).
Regenerating bindings
When a Go service signature changes:
wails3 generate bindings
task dev does this automatically on *.go save.
Tray icons
Source SVGs live in assets/svg/ (state.svg + state-macos.svg). After editing
any SVG, rasterize to the PNGs the Go side embeds:
task common:generate:tray:icons
Requires Inkscape. Commit the resulting assets/*.png files alongside the
SVG change so CI doesn't need Inkscape installed.