mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-31 21:19:55 +00:00
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.
41 lines
1.3 KiB
Go
41 lines
1.3 KiB
Go
//go:build linux
|
||
|
||
package main
|
||
|
||
import _ "embed"
|
||
|
||
// 24x24 menu-row icons used on Linux. GTK4 menu rows accept icons in the
|
||
// 22–48 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
|