mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-31 12:01:29 +02:00
microsoft windows only: open application on left click and tray menu on right click
This commit is contained in:
@@ -189,9 +189,10 @@ func NewTray(app *application.App, window *application.WebviewWindow, svc TraySe
|
||||
t.tray.SetMenu(t.menu)
|
||||
// macOS/Linux give click→menu natively, so bindTrayClick is a no-op there
|
||||
// (binding OnClick→OpenMenu on macOS would freeze the tray); Windows has no
|
||||
// native handler so it wires one (see tray_click_*.go). On Linux
|
||||
// AttachWindow is skipped — with applySmartDefaults it would pop the window
|
||||
// alongside the menu (e.g. GNOME Shell AppIndicator).
|
||||
// native left-click handler so it wires one to open the main window, leaving
|
||||
// the menu on right-click (see tray_click_*.go). On Linux AttachWindow is
|
||||
// skipped — with applySmartDefaults it would pop the window alongside the
|
||||
// menu (e.g. GNOME Shell AppIndicator).
|
||||
bindTrayClick(t)
|
||||
|
||||
app.Event.On(services.EventStatusSnapshot, t.onStatusEvent)
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
|
||||
package main
|
||||
|
||||
// bindTrayClick wires the tray icon's click handlers on Windows.
|
||||
//
|
||||
// Wails v3's Windows systray leaves left-click a no-op (only right-click opens
|
||||
// the menu), so bind OnClick to OpenMenu to match macOS/Linux. The macOS freeze
|
||||
// that blocks OnClick→OpenMenu doesn't apply here: openMenu() is the same
|
||||
// menu.ShowAt() path right-click already uses.
|
||||
// Open application window on left click, right click opens the tray menu
|
||||
func bindTrayClick(t *Tray) {
|
||||
t.tray.OnClick(func() { t.tray.OpenMenu() })
|
||||
t.tray.OnDoubleClick(func() { t.ShowWindow() })
|
||||
t.tray.OnClick(func() { t.ShowWindow() })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user