mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-24 06:19:08 +02:00
Fix hover label on linux (#6318)
This commit is contained in:
@@ -4,6 +4,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -193,6 +194,15 @@ func NewTray(app *application.App, window *application.WebviewWindow, svc TraySe
|
|||||||
t.tray = app.SystemTray.New()
|
t.tray = app.SystemTray.New()
|
||||||
t.applyIcon()
|
t.applyIcon()
|
||||||
t.tray.SetTooltip(t.loc.T("tray.tooltip"))
|
t.tray.SetTooltip(t.loc.T("tray.tooltip"))
|
||||||
|
// On Linux the SNI hover tooltip is sourced from the systray *Label*
|
||||||
|
// (the StatusNotifierItem Title/ToolTip props), not SetTooltip —
|
||||||
|
// SetTooltip is a no-op on Linux. With no label set, Wails falls back
|
||||||
|
// to the literal "Wails", so set it explicitly here. macOS is skipped
|
||||||
|
// because its setLabel paints visible text next to the icon; Windows
|
||||||
|
// is skipped because its tooltip comes from SetTooltip above.
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
t.tray.SetLabel(t.loc.T("tray.tooltip"))
|
||||||
|
}
|
||||||
t.menu = t.buildMenu()
|
t.menu = t.buildMenu()
|
||||||
t.tray.SetMenu(t.menu)
|
t.tray.SetMenu(t.menu)
|
||||||
// Left-click on the tray icon opens the menu, and the window is reached
|
// Left-click on the tray icon opens the menu, and the window is reached
|
||||||
@@ -284,6 +294,11 @@ func (t *Tray) ShowWindow() {
|
|||||||
// rebuild.
|
// rebuild.
|
||||||
func (t *Tray) applyLanguage() {
|
func (t *Tray) applyLanguage() {
|
||||||
t.tray.SetTooltip(t.loc.T("tray.tooltip"))
|
t.tray.SetTooltip(t.loc.T("tray.tooltip"))
|
||||||
|
// Mirror the Linux label fix from NewTray — the SNI hover tooltip
|
||||||
|
// rides on the label, so refresh it on language change too.
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
t.tray.SetLabel(t.loc.T("tray.tooltip"))
|
||||||
|
}
|
||||||
t.menu = t.buildMenu()
|
t.menu = t.buildMenu()
|
||||||
t.tray.SetMenu(t.menu)
|
t.tray.SetMenu(t.menu)
|
||||||
t.reapplyMenuState()
|
t.reapplyMenuState()
|
||||||
|
|||||||
Reference in New Issue
Block a user