Files
netbird/client/ui/icons_menu_windows.go
T
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

43 lines
1.5 KiB
Go

//go:build windows
package main
import _ "embed"
// 16x16 menu-row icons used on Windows. The Win32 SetMenuItemBitmaps API
// paints the HBITMAP into the check-mark slot, sized to SM_CXMENUCHECK /
// SM_CYMENUCHECK (typically 16x16 at 100% DPI). Larger bitmaps overflow
// the row visually, so Windows ships its own scaled set instead of the
// 24x24 assets used on macOS/Linux. Regenerate the brand mark from
// assets/svg/netbird-menu.svg (vector source — re-rendering keeps the
// strokes crisp at every target size):
// inkscape assets/svg/netbird-menu.svg -o netbird-menu-16.png -w 16 -h 16 \
// --export-background-opacity=0
// The status dots are downscaled from the 24x24 originals with
// ImageMagick — simple solid-fill circles survive the bicubic resize
// without visible quality loss:
// magick netbird-menu-dot-<state>.png -resize 16x16 \
// -background none -gravity center -extent 16x16 \
// netbird-menu-dot-<state>-16.png
//go:embed assets/netbird-menu-16.png
var iconMenuNetbird []byte
//go:embed assets/netbird-menu-dot-connected-16.png
var iconMenuDotConnected []byte
//go:embed assets/netbird-menu-dot-connecting-16.png
var iconMenuDotConnecting []byte
//go:embed assets/netbird-menu-dot-login-16.png
var iconMenuDotLogin []byte
//go:embed assets/netbird-menu-dot-error-16.png
var iconMenuDotError []byte
//go:embed assets/netbird-menu-dot-idle-16.png
var iconMenuDotIdle []byte
//go:embed assets/netbird-menu-dot-offline-16.png
var iconMenuDotOffline []byte