diff --git a/cmd/systray/systray.go b/cmd/systray/systray.go index 5f498f35f..0d6f87916 100644 --- a/cmd/systray/systray.go +++ b/cmd/systray/systray.go @@ -199,14 +199,14 @@ func (menu *Menu) rebuild() { case ipn.Running.String(): if menu.status.ExitNodeStatus != nil && !menu.status.ExitNodeStatus.ID.IsZero() { if menu.status.ExitNodeStatus.Online { - systray.SetTitle("Using exit node") + setTooltip("Using exit node") setAppIcon(exitNodeOnline) } else { - systray.SetTitle("Exit node offline") + setTooltip("Exit node offline") setAppIcon(exitNodeOffline) } } else { - systray.SetTitle(fmt.Sprintf("Connected to %s", menu.status.CurrentTailnet.Name)) + setTooltip(fmt.Sprintf("Connected to %s", menu.status.CurrentTailnet.Name)) setAppIcon(connected) } menu.connect.SetTitle("Connected") @@ -214,10 +214,10 @@ func (menu *Menu) rebuild() { menu.disconnect.Show() menu.disconnect.Enable() case ipn.Starting.String(): - systray.SetTitle("Connecting") + setTooltip("Connecting") setAppIcon(loading) default: - systray.SetTitle("Disconnected") + setTooltip("Disconnected") setAppIcon(disconnected) } @@ -312,6 +312,16 @@ func setRemoteIcon(menu *systray.MenuItem, urlStr string) { } } +// setTooltip sets the tooltip text for the systray icon. +func setTooltip(text string) { + if runtime.GOOS == "darwin" || runtime.GOOS == "windows" { + systray.SetTooltip(text) + } else { + // on Linux, SetTitle actually sets the tooltip + systray.SetTitle(text) + } +} + // eventLoop is the main event loop for handling click events on menu items // and responding to Tailscale state changes. // This method does not return until ctx.Done is closed.