Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/menubar/companion_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Binary file modified internal/menubar/icon_template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified internal/menubar/icon_template@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions internal/menubar/icon_test.go
Original file line number Diff line number Diff line change
@@ -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")
}
}
2 changes: 1 addition & 1 deletion internal/menubar/tray_display.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down
8 changes: 4 additions & 4 deletions internal/menubar/tray_display_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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%")
}
}

Expand Down Expand Up @@ -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}
Expand Down
Loading