mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-04 19:55:09 -04:00
## Describe your changes On SNI hosts that report icon clicks via Activate (KDE Plasma, Waybar), Wails fired the left-click handler on every dbusmenu 'opened' event, so a right click opened the tray menu and immediately raised the main window, which stole focus and closed the menu. Host Left click Right click KDE Plasma, Waybar main window (Activate) menu (host-rendered) GNOME Shell + AppIndicator menu only menu only Minimal WMs via XEmbed host main window (Activate) XEmbed GTK popup Point the wails/v3 replace at the netbirdio fork (v3.0.0-beta.3 plus the fix): once the host has sent Activate/SecondaryActivate, a menu open no longer fires the click handler, while AppIndicator-only hosts that signal clicks solely via 'opened' keep the old behavior. ## Issue ticket number and link <!-- Required for anything that changes behavior. Link the issue (or the validated discussion it came from) that the NetBird team already agreed on. See https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#ticket-first-pr-second --> ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] I ran and tested this change locally — I did not rely on CI to find out whether it works - [ ] This PR has a single purpose (not a fix + refactor + feature in one) - [ ] This change is a trivial fix, **OR** it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#ticket-first-pr-second). > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Chores * Updated underlying application components to support compatibility and ongoing maintenance. * Clarified Linux tray interaction documentation, including platform-specific left- and right-click behavior and menu activation. * No user-facing features, workflow changes, or visual updates are included. * Existing Linux tray behavior remains unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
41 lines
2.0 KiB
Go
41 lines
2.0 KiB
Go
//go:build linux && !(linux && 386)
|
|
|
|
package main
|
|
|
|
// bindTrayClick wires the tray icon's left-click handler on Linux.
|
|
//
|
|
// Expected behaviour per tray host:
|
|
//
|
|
// Host Left click Right click
|
|
// KDE Plasma, Waybar main window (Activate) menu (host-rendered)
|
|
// GNOME Shell + AppIndicator menu only menu only
|
|
// Minimal WMs via XEmbed host main window (Activate) XEmbed GTK popup
|
|
//
|
|
// OnClick fires only on org.kde.StatusNotifierItem.Activate — a real left
|
|
// click. KDE/Waybar send it over D-Bus; the in-process XEmbed host
|
|
// (xembed_host_linux.go) maps a Button1 press to the same Activate call.
|
|
//
|
|
// GNOME Shell + AppIndicator never sends Activate: it renders the dbusmenu
|
|
// on ANY click and only reports the menu opening via dbusmenu
|
|
// Event("opened"). Upstream Wails treated that event as a click, so on GNOME
|
|
// both buttons raised the main window on top of the menu, and on KDE/Waybar
|
|
// a right click raised it over the freshly opened menu. The netbirdio/wails
|
|
// fork (go.mod replace) drops that heuristic: a menu open never fires
|
|
// OnClick. On GNOME the main window is reached via the "Open NetBird" menu
|
|
// entry; left-click-opens-window is not achievable there anyway, since the
|
|
// host always opens the menu itself.
|
|
//
|
|
// We do NOT register OnDoubleClick: Wails' Linux SNI backend never fires it
|
|
// (unlike Windows). And we deliberately skip AttachWindow — it plus Wails3's
|
|
// applySmartDefaults would pop the window alongside the menu on GNOME Shell
|
|
// with the AppIndicator extension (see the bindTrayClick comment in tray.go).
|
|
//
|
|
// ShowWindow() is the same dispatcher the explicit "Open NetBird" menu entry
|
|
// and SIGUSR1 use: it brings the install-progress / browser-login window
|
|
// forward when one of those flows is active, otherwise routes through
|
|
// WindowManager.ShowMain so the window re-centers on minimal WMs / the XEmbed
|
|
// path instead of landing in the top-left corner.
|
|
func bindTrayClick(t *Tray) {
|
|
t.tray.OnClick(func() { t.ShowWindow() })
|
|
}
|