feat: use PDF vector icon for crisp menubar rendering#43
feat: use PDF vector icon for crisp menubar rendering#43prakersh merged 2 commits intoonllm-dev:mainfrom
Conversation
jinquan-shi
commented
Mar 24, 2026
- Use PDF icon via systray.SetIcon for sharp 4K display support
- Fall back to PNG template icons if PDF unavailable
- Add thin space between icon and text in tray display
- Add icon_test.go with PDF/PNG validation tests
- Use PDF icon via systray.SetIcon for sharp 4K display support - Fall back to PNG template icons if PDF unavailable - Add thin space between icon and text in tray display - Add icon_test.go with PDF/PNG validation tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
prakersh
left a comment
There was a problem hiding this comment.
Thanks for the contribution! The goal of crisp 4K rendering makes sense. A few observations:
Template icon regression
systray.SetIcon(pdfIcon) sets template=false internally, which means the icon won't adapt to macOS light/dark menu bar appearance. The original SetTemplateIcon call sets template=true, which is what makes the icon render correctly in both themes.
PDF format is not cross-platform
The systray library documents supported formats as .ico/.jpg/.png. PDF only works here because the macOS backend calls NSImage initWithData: which happens to support PDF natively - this is an undocumented implementation detail, not a guaranteed API contract. On Linux (D-Bus/StatusNotifierItem) and Windows (HICON), PDF won't work at all.
This is especially relevant since #35 is actively extending the menubar companion to Linux (and Windows is planned after that). Merging a macOS-only icon format now would create an immediate conflict with the cross-platform direction.
Suggestion: use higher-quality PNGs instead
The blurriness on 4K is likely from the source PNGs, not the format itself. A well-crafted PNG exported from the vector source at proper sizes should look crisp on Retina/4K. I'd suggest providing 64x64 or 128x128 hi-res PNGs - SetTemplateIcon will handle the scaling, and it works cross-platform out of the box with no build tags or undocumented behavior needed.
Dead fallback path
Since IconPDF is loaded via go:embed, len(pdfIcon) > 0 will always be true - the PNG fallback branch can never execute.
The thin space and tests are nice additions - happy to keep those parts. Would you be open to swapping the PDF approach for higher-quality PNGs?
macOS systray works better with PNG template/retina icons than PDF. Remove PDF icon support and associated tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for the review! @prakersh Following the feedback regarding 4K rendering and macOS template support, I've updated the PR with the following changes:
These changes achieve the goal of "crisp 4K rendering" without sacrificing cross-platform compatibility or native macOS behavior. |
prakersh
left a comment
There was a problem hiding this comment.
Thanks for the updates, @jinquan-shi! The revised approach looks great - ultra-high res PNGs for crisp 4K rendering while keeping SetTemplateIcon for proper light/dark mode adaptation. Clean and well-tested. Merging!