Repository navigation
fix(tray): stop the macOS menu bar item taking half again the width of its neighbours - #508
Merged
Merged
Conversation
…m is 32 pt, not 48 The SDK gives the status item the file's image and only then shrinks it to 16 pt; the item keeps the first width. A 32 px template at the default 72 dpi loads at 32 pt, so the idle item was 48 pt wide with blank space beside the mark. Writing a pHYs chunk of 144 dpi makes the same 32 px file load at 16 pt: the item is 32 pt and the mark stays sharp on a Retina display.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
akou's menu bar item on macOS was 48 pt wide, with blank space beside the mark, while the items around it are 24 to 40 pt.
The cause is the order in which the SDK builds the status item. It gives the button the file's image, then shrinks that image to 16 pt. The button keeps the width of the first image. Our template is 32 px at the default 72 dpi, so it loads at 32 pt and the item stays sized for that.
Measured with a minimal AppKit program that does the same as the SDK:
The fix:
scripts/tray-icons.tswrites apHYschunk of 144 dpi into the two macOS templates. The same 32 px file now loads at 16 pt, so the item is 32 pt and the mark stays sharp on a Retina display. The Windows and Linux icons are unchanged.Test:
[DK-T1] A wide tray itemintests/shell.test.tschecks both templates load at 16 pt. A PNG with nopHYsis the positive control, and the old icon file fails the test (expected 16, received 32). The trap is indocs/TRAPS.md.