diff --git a/internal/menubar/companion_darwin.go b/internal/menubar/companion_darwin.go index 140ebde..467c44d 100644 --- a/internal/menubar/companion_darwin.go +++ b/internal/menubar/companion_darwin.go @@ -66,7 +66,7 @@ func (c *trayController) onReady() { templateIcon, regularIcon := trayIcons() if len(templateIcon) > 0 && len(regularIcon) > 0 { systray.SetTemplateIcon(templateIcon, regularIcon) - logger.Debug("Tray icon set successfully") + logger.Debug("Tray icon set from PNG") } systray.SetTooltip("onWatch menubar companion") diff --git a/internal/menubar/icon_template.png b/internal/menubar/icon_template.png index d4877cb..6ea247f 100644 Binary files a/internal/menubar/icon_template.png and b/internal/menubar/icon_template.png differ diff --git a/internal/menubar/icon_template@2x.png b/internal/menubar/icon_template@2x.png index 236561e..4c33815 100644 Binary files a/internal/menubar/icon_template@2x.png and b/internal/menubar/icon_template@2x.png differ diff --git a/internal/menubar/icon_test.go b/internal/menubar/icon_test.go new file mode 100644 index 0000000..df30baf --- /dev/null +++ b/internal/menubar/icon_test.go @@ -0,0 +1,46 @@ +package menubar + +import ( + "bytes" + "image/png" + "testing" +) + +func TestTrayIconsDimensions(t *testing.T) { + template, retina := trayIcons() + + checkDim := func(data []byte, name string, expected int) { + img, err := png.Decode(bytes.NewReader(data)) + if err != nil { + t.Fatalf("failed to decode %s: %v", name, err) + } + bounds := img.Bounds() + if bounds.Dx() != expected || bounds.Dy() != expected { + t.Errorf("%s dimensions expected %dx%d, got %dx%d", name, expected, expected, bounds.Dx(), bounds.Dy()) + } + } + + checkDim(template, "template", 256) + checkDim(retina, "retina", 512) +} + +func TestTrayIconsPNGNotEmpty(t *testing.T) { + template, retina := trayIcons() + if len(template) == 0 { + t.Fatal("trayIcons() template is empty") + } + if len(retina) == 0 { + t.Fatal("trayIcons() retina is empty") + } +} + +func TestTrayIconsPNGLen(t *testing.T) { + template, retina := trayIcons() + // Verify reasonable PNG header + if string(template[:8]) != "\x89PNG\r\n\x1a\n" { + t.Fatal("template icon does not have PNG header") + } + if string(retina[:8]) != "\x89PNG\r\n\x1a\n" { + t.Fatal("retina icon does not have PNG header") + } +} diff --git a/internal/menubar/tray_display.go b/internal/menubar/tray_display.go index a5c3d94..f9ecde8 100644 --- a/internal/menubar/tray_display.go +++ b/internal/menubar/tray_display.go @@ -75,7 +75,7 @@ func joinTrayParts(parts []string) string { if len(parts) == 0 { return "" } - out := parts[0] + out := "\u2009" + parts[0] for i := 1; i < len(parts); i++ { out += " │ " + parts[i] } diff --git a/internal/menubar/tray_display_test.go b/internal/menubar/tray_display_test.go index 8416604..833563b 100644 --- a/internal/menubar/tray_display_test.go +++ b/internal/menubar/tray_display_test.go @@ -41,8 +41,8 @@ func TestTrayTitleProviderSpecific(t *testing.T) { }, } - if got := TrayTitle(snapshot, settings); got != "84%" { - t.Fatalf("TrayTitle(multi_provider) = %q, want %q", got, "84%") + if got := TrayTitle(snapshot, settings); got != "\u200984%" { + t.Fatalf("TrayTitle(multi_provider) = %q, want %q", got, "\u200984%") } } @@ -73,8 +73,8 @@ func TestTrayTitleCriticalCountAndIconOnly(t *testing.T) { {ProviderID: "copilot"}, }, } - if got := TrayTitle(snapshot, settings); got != "84% │ 12%" { - t.Fatalf("TrayTitle(multi_provider multiple) = %q, want %q", got, "84% │ 12%") + if got := TrayTitle(snapshot, settings); got != "\u200984% │ 12%" { + t.Fatalf("TrayTitle(multi_provider multiple) = %q, want %q", got, "\u200984% │ 12%") } settings.StatusDisplay = StatusDisplay{Mode: StatusDisplayIconOnly}