Files
netbird/client/ui/icons.go
Zoltán Papp 85029898a5 per-platform tray menu icons and Windows-specific status row
The Windows menu renderer paints leading bitmaps into the Win32
check-mark slot (SetMenuItemBitmaps), which differs from how Cocoa
and GTK handle NSMenuItem.image / menu-row icons:

  - SM_CXMENUCHECK sizing: Windows expects ~16x16 at 100% DPI in the
    check-mark slot and visually overflows the row for anything bigger.
  - Disabled-state mask: Windows desaturates both the row text and the
    bitmap when MFS_DISABLED is set, so a disabled informational row
    renders the coloured status dot in greyscale.

Per the platform icon guidelines:

  Platform | Size           | Notes
  ---------|----------------|-----------------------------------------
  Windows  | 16x16          | check-mark slot, status row stays enabled
  macOS    | 22x22 (18-22)  | NSMenuItem leading image, HIG
  Linux    | 24x24 (22-48)  | GTK4 menu-row icon channel

Changes:

  * Split the menu-row icon embeds into icons_menu_{windows,darwin,linux}.go
    so each platform pulls its own size; the brand mark is rendered from
    assets/svg/netbird-menu.svg (new vector source) at 16/22/24 px with
    Inkscape, and the Windows status dots ship as 8x8 content centred on
    a 16x16 transparent canvas (the renderer upscales the bitmap, so the
    padding keeps the dot visually proportional to the row text).

  * Introduce statusRowEnabled() in tray_status_enabled_{windows,other}.go:
    true on Windows so the disabled-state mask does not strip the dot's
    colour; false on macOS/Linux where disabled menu rows fade the label
    without desaturating the leading bitmap, signalling that the row is
    informational.

  * Add an icon to the About submenu using the same brand mark.
2026-05-21 16:41:52 +02:00

68 lines
2.2 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
//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.