mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-30 12:39:54 +00:00
tray: show NetBird brand mark next to About on macOS
NSMenuItem rejected the dedicated netbird-menu-24.png brand mark (rendered muddy) and the full 256x256 brand PNG (stretched the row). Ship an 18x18 sips-downscale of assets/netbird.png — same source the legacy Fyne client used for its About row — to sit visually alongside the cap-height of the surrounding text.
This commit is contained in:
BIN
client/ui/assets/netbird-menu-about-18.png
Normal file
BIN
client/ui/assets/netbird-menu-about-18.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 838 B |
@@ -10,16 +10,15 @@ import _ "embed"
|
||||
// (Win32 SM_CXMENUCHECK slot) and Linux a 24x24 variant (GTK menu row
|
||||
// supports the larger range) — see the sibling icons_menu_*.go files.
|
||||
//
|
||||
// iconMenuNetbird is intentionally empty on macOS. NSMenuItem.setImage
|
||||
// stretches the row height to the leading image's pixel size, which
|
||||
// makes the About row taller than the unadorned rows above and below
|
||||
// it regardless of the PNG size we ship. The brand mark is rendered
|
||||
// only on Windows and Linux (see those platforms' icons_menu_*.go
|
||||
// files); on macOS the About row stays text-only — the tray icon
|
||||
// itself already supplies the brand presence.
|
||||
//
|
||||
// Status dots are downscaled from the 24x24 originals with ImageMagick.
|
||||
// iconMenuNetbird on macOS is an 18x18 downscale of the 256x256 brand
|
||||
// PNG (assets/netbird.png — the same file the legacy Fyne client used
|
||||
// for its About row). Sized to sit visually alongside the row text —
|
||||
// the full 256x256 source stretched the row vertically, 22x22 read
|
||||
// noticeably larger than the surrounding "A" of "About", and 14x14
|
||||
// shrank below the cap height. 18 keeps the brand mark legible without
|
||||
// dominating the row.
|
||||
|
||||
//go:embed assets/netbird-menu-about-18.png
|
||||
var iconMenuNetbird []byte
|
||||
|
||||
//go:embed assets/netbird-menu-dot-connected-22.png
|
||||
|
||||
@@ -403,10 +403,10 @@ func (t *Tray) buildMenu() *application.Menu {
|
||||
|
||||
aboutLabel := t.loc.T("tray.menu.about")
|
||||
about := menu.AddSubmenu(aboutLabel)
|
||||
// iconMenuNetbird is empty on macOS — NSMenuItem.setImage stretches
|
||||
// the row to the leading image's pixel size, and the result looks
|
||||
// out of place next to the unadorned rows above and below. Skip the
|
||||
// brand mark there and keep the row text-only.
|
||||
// iconMenuNetbird is the brand mark painted in the leading-image slot
|
||||
// of the About row. The icons_menu_<os>.go files own the per-platform
|
||||
// asset choice — guard with len() so a platform that opts out (sets
|
||||
// it to an empty []byte) still renders the row text-only.
|
||||
if aboutItem := menu.FindByLabel(aboutLabel); aboutItem != nil && len(iconMenuNetbird) > 0 {
|
||||
aboutItem.SetBitmap(iconMenuNetbird)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user