client/ui: open main window on tray left-click on Linux

KDE Plasma routes a tray left-click to the SNI Activate method (right-click
opens the context menu), but NetBird wired no Activate action, so on KDE a
left-click appeared completely dead while only right-click surfaced the menu.

Bind the Linux tray OnClick handler to ShowWindow(). OpenMenu() is not an
option on Linux: Wails v3 leaves linuxSystemTray.openMenu unimplemented (it
only logs), so left-click→OpenMenu would still do nothing on KDE. ShowWindow()
is the same call Windows already runs from its double-click handler, and it
does not reproduce the macOS OpenMenu freeze (c77e5cef8) — that came from
NSStatusItem's blocking embedded menu loop, whereas Show/Focus return
immediately.

Split the Linux click handler into its own tray_click_linux.go and narrow the
macOS no-op bindTrayClick build tag accordingly. The context menu stays on
right-click on every host. On hosts that already open the menu on left-click
natively (GNOME Shell + AppIndicator) left-click now opens the window instead;
the menu remains on right-click.
This commit is contained in:
Zoltán Papp
2026-06-01 22:04:49 +02:00
parent 072d789463
commit dfee5252a3
3 changed files with 50 additions and 21 deletions
+7 -9
View File
@@ -1,13 +1,11 @@
//go:build !windows && !android && !ios && !freebsd && !js
//go:build !windows && !linux && !android && !ios && !freebsd && !js
package main
// bindTrayClick is a no-op on macOS and Linux. On macOS the native
// NSStatusItem auto-shows the menu on left-click; on Linux the
// StatusNotifierItem host paints the menu independently. Binding an
// OnClick→OpenMenu handler is both unnecessary there and actively harmful on
// macOS, where OpenMenu routes through NSStatusItem's blocking [button
// mouseDown:] on the serial main GCD queue and freezes the tray and webview
// until the menu closes (commit c77e5cef8). Windows opts in via the sibling
// tray_click_windows.go file.
// bindTrayClick is a no-op on macOS. The native NSStatusItem auto-shows the
// menu on left-click, so binding an OnClick→OpenMenu handler is both
// unnecessary and actively harmful: OpenMenu routes through NSStatusItem's
// blocking [button mouseDown:] on the serial main GCD queue and freezes the
// tray and webview until the menu closes (commit c77e5cef8). Windows opts in
// via tray_click_windows.go; Linux via tray_click_linux.go.
func bindTrayClick(*Tray) {}