mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-19 15:01:29 +02:00
Linux now shows monochrome (black/white silhouette) tray icons instead of the colored orange PNGs, matching the macOS template look. Since Wails' Linux SNI backend ignores SetDarkModeIcon (its setDarkModeIcon just calls setIcon, last-write-wins) and the SNI spec carries no panel light/dark hint, the panel color scheme is detected in-process and the black-vs-white silhouette is chosen in iconForState, pushed via a single SetIcon. Detection order (tray_theme_linux.go): freedesktop Settings portal (org.freedesktop.appearance/color-scheme) -> GTK_THEME env (:dark suffix) -> default dark. A SettingChanged subscription repaints live on theme flips. macOS (template) and Windows (colored) paths are unchanged. Icons are 48x48 mono PNGs (3% margin) generated from the macOS silhouettes.
117 lines
3.9 KiB
Go
117 lines
3.9 KiB
Go
//go:build !android && !ios && !freebsd && !js
|
|
|
|
package main
|
|
|
|
import _ "embed"
|
|
|
|
// Tray icons embedded from the legacy Fyne UI's asset set. Each pair is a
|
|
// light-mode PNG and its dark-mode variant; macOS template variants
|
|
// (*-macos.png) live alongside for menubar use. Windows uses the same
|
|
// PNGs — multi-resolution .ico files looked promising on disk but
|
|
// Wails3's Shell_NotifyIcon NIM_MODIFY never redrew them on the running
|
|
// tray; PNG single-frame works.
|
|
|
|
//go:embed assets/netbird-systemtray-connected.png
|
|
var iconConnected []byte
|
|
|
|
//go:embed assets/netbird-systemtray-connected-dark.png
|
|
var iconConnectedDark []byte
|
|
|
|
//go:embed assets/netbird-systemtray-disconnected.png
|
|
var iconDisconnected []byte
|
|
|
|
//go:embed assets/netbird-systemtray-connecting.png
|
|
var iconConnecting []byte
|
|
|
|
//go:embed assets/netbird-systemtray-error.png
|
|
var iconError []byte
|
|
|
|
//go:embed assets/netbird-systemtray-needs-login.png
|
|
var iconNeedsLogin []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-connected.png
|
|
var iconUpdateConnected []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-disconnected.png
|
|
var iconUpdateDisconnected []byte
|
|
|
|
//go:embed assets/netbird-systemtray-connected-macos.png
|
|
var iconConnectedMacOS []byte
|
|
|
|
//go:embed assets/netbird-systemtray-disconnected-macos.png
|
|
var iconDisconnectedMacOS []byte
|
|
|
|
//go:embed assets/netbird-systemtray-connecting-macos.png
|
|
var iconConnectingMacOS []byte
|
|
|
|
//go:embed assets/netbird-systemtray-error-macos.png
|
|
var iconErrorMacOS []byte
|
|
|
|
//go:embed assets/netbird-systemtray-needs-login-macos.png
|
|
var iconNeedsLoginMacOS []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-connected-macos.png
|
|
var iconUpdateConnectedMacOS []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-disconnected-macos.png
|
|
var iconUpdateDisconnectedMacOS []byte
|
|
|
|
// Linux monochrome tray icons. Linux's SNI tray has no template-recoloring
|
|
// (unlike macOS's SetTemplateIcon), so we ship an explicit black/white pair:
|
|
// the black silhouette (*-mono.png) goes to SetIcon for light panels, the
|
|
// white one (*-mono-dark.png) goes to SetDarkModeIcon for dark panels, and
|
|
// the SNI host picks per panel theme. Generated from the macOS template
|
|
// silhouettes — states differ by shape, not color.
|
|
|
|
//go:embed assets/netbird-systemtray-connected-mono.png
|
|
var iconConnectedMono []byte
|
|
|
|
//go:embed assets/netbird-systemtray-connected-mono-dark.png
|
|
var iconConnectedMonoDark []byte
|
|
|
|
//go:embed assets/netbird-systemtray-connecting-mono.png
|
|
var iconConnectingMono []byte
|
|
|
|
//go:embed assets/netbird-systemtray-connecting-mono-dark.png
|
|
var iconConnectingMonoDark []byte
|
|
|
|
//go:embed assets/netbird-systemtray-disconnected-mono.png
|
|
var iconDisconnectedMono []byte
|
|
|
|
//go:embed assets/netbird-systemtray-disconnected-mono-dark.png
|
|
var iconDisconnectedMonoDark []byte
|
|
|
|
//go:embed assets/netbird-systemtray-error-mono.png
|
|
var iconErrorMono []byte
|
|
|
|
//go:embed assets/netbird-systemtray-error-mono-dark.png
|
|
var iconErrorMonoDark []byte
|
|
|
|
//go:embed assets/netbird-systemtray-needs-login-mono.png
|
|
var iconNeedsLoginMono []byte
|
|
|
|
//go:embed assets/netbird-systemtray-needs-login-mono-dark.png
|
|
var iconNeedsLoginMonoDark []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-connected-mono.png
|
|
var iconUpdateConnectedMono []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-connected-mono-dark.png
|
|
var iconUpdateConnectedMonoDark []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-disconnected-mono.png
|
|
var iconUpdateDisconnectedMono []byte
|
|
|
|
//go:embed assets/netbird-systemtray-update-disconnected-mono-dark.png
|
|
var iconUpdateDisconnectedMonoDark []byte
|
|
|
|
//go:embed assets/netbird.png
|
|
var iconWindow []byte
|
|
|
|
// Per-platform menu-row icons (status dots + NetBird brand mark) live in
|
|
// icons_menu_windows.go and icons_menu_other.go. Windows installs them
|
|
// into the Win32 check-mark slot, which expects SM_CXMENUCHECK-sized
|
|
// bitmaps (~16x16 at 100% DPI) — anything bigger gets cropped, anything
|
|
// smaller leaves blank space — so Windows ships its own 16x16 set
|
|
// while macOS/Linux keep the larger 24x24 assets that fit their menus.
|