mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-30 19:41:30 +02:00
skip About-row brand mark on macOS
NSMenuItem.setImage stretches the row to the leading image's pixel size regardless of the surrounding rows, so any non-empty bitmap on the About entry made it visibly taller than the rest of the tray menu — leaving 16, 18 or 22 px versions all looking wrong next to the unadorned rows above and below. Drop the macOS brand mark and gate the SetBitmap call on a non-empty byte slice; iconMenuNetbird is now nil on macOS, so the About row falls back to text only. Windows and Linux still ship the brand mark through their per-platform embed files.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 687 B |
@@ -4,20 +4,22 @@ package main
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// 22x22 menu-row icons used on macOS. Apple's HIG recommends an 18–22 px
|
||||
// glyph for NSMenuItem leading images; 22 sits at the top of that range
|
||||
// and matches the visual weight of the surrounding row text. Windows
|
||||
// ships a 16x16 variant (Win32 SM_CXMENUCHECK slot) and Linux a 24x24
|
||||
// variant (GTK menu row supports the larger range) — see the sibling
|
||||
// icons_menu_*.go files.
|
||||
// 22x22 status dot icons used on macOS. Apple's HIG recommends an
|
||||
// 18–22 px glyph for NSMenuItem leading images; 22 matches the visual
|
||||
// weight of the surrounding row text. Windows ships a 16x16 variant
|
||||
// (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.
|
||||
//
|
||||
// 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-22.png -w 22 -h 22 \
|
||||
// --export-background-opacity=0
|
||||
// Status dots are downscaled from the 24x24 originals with ImageMagick.
|
||||
|
||||
//go:embed assets/netbird-menu-22.png
|
||||
var iconMenuNetbird []byte
|
||||
|
||||
//go:embed assets/netbird-menu-dot-connected-22.png
|
||||
|
||||
@@ -383,7 +383,11 @@ func (t *Tray) buildMenu() *application.Menu {
|
||||
|
||||
aboutLabel := t.loc.T("tray.menu.about")
|
||||
about := menu.AddSubmenu(aboutLabel)
|
||||
if aboutItem := menu.FindByLabel(aboutLabel); aboutItem != nil {
|
||||
// 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.
|
||||
if aboutItem := menu.FindByLabel(aboutLabel); aboutItem != nil && len(iconMenuNetbird) > 0 {
|
||||
aboutItem.SetBitmap(iconMenuNetbird)
|
||||
}
|
||||
about.Add(t.loc.T("tray.menu.github")).OnClick(func(*application.Context) {
|
||||
|
||||
Reference in New Issue
Block a user