Files
netbird/client/ui/icons_menu_linux.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

41 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//go:build linux
package main
import _ "embed"
// 24x24 menu-row icons used on Linux. GTK4 menu rows accept icons in the
// 2248 px range with no automatic downscaling at this size; 24 reads
// cleanly next to the row text across the GNOME / KDE / minimal-WM
// flavours we ship to. Windows ships a 16x16 variant (Win32
// SM_CXMENUCHECK slot) and macOS a 22x22 variant — see the sibling
// icons_menu_*.go files.
//
// 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-24.png -w 24 -h 24 \
// --export-background-opacity=0
// Status dots are the canonical 24x24 originals used everywhere else
// in the legacy Fyne tray.
//go:embed assets/netbird-menu-24.png
var iconMenuNetbird []byte
//go:embed assets/netbird-menu-dot-connected.png
var iconMenuDotConnected []byte
//go:embed assets/netbird-menu-dot-connecting.png
var iconMenuDotConnecting []byte
//go:embed assets/netbird-menu-dot-login.png
var iconMenuDotLogin []byte
//go:embed assets/netbird-menu-dot-error.png
var iconMenuDotError []byte
//go:embed assets/netbird-menu-dot-idle.png
var iconMenuDotIdle []byte
//go:embed assets/netbird-menu-dot-offline.png
var iconMenuDotOffline []byte