Repository navigation
fix: draw borders in whole pixels so they keep every edge on 1x screens - #934
Conversation
There was a problem hiding this comment.
1 issue found across 43 files
You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Sources/StableBar/Bar/PixelBorder.swift">
<violation number="1" location="Sources/StableBar/Bar/PixelBorder.swift:6">
P3: A retained non-1 `bar.displayScale` scales these already-rounded borders afterward, so a 1-pixel stroke can become fractional again (for example, 1.5 pixels). Account for that transform when quantizing the width, or round the border after the transform.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
On a screen that isn't Retina, a border 0.5 or 1.5 points wide leaves a row of pixels it covers only in part, and macOS leaves that part out along a straight top or left edge while drawing it along the bottom and right. Setup's cards lost their top and left edges, and Fern's 1.5 pt workspace outline had a gap along its top. pixelBorder rounds a border's width on screen to whole pixels, at least one, and every border now goes through it, a theme's borderWidth included. Retina screens draw the same widths as before. Offscreen drawings keep the width they're given: Core Graphics draws them, and draws these borders evenly at any scale, so CI's screens and Share My Bar's images don't change. Fixes #933
A border drawn with strokeBorder can fall between pixels on a 1x screen, whether its width comes from the code or from a theme, so a rule in ArchitectureRulesTests points new borders to pixelBorder. DECISIONS.md records the rule, why a stroke centred on the edge is left alone, and why offscreen drawings keep their widths. Refs #933
7c80b83 to
baf8453
Compare
Before and after
202 unchanged screens
Visual review: 202 screens, none changed. |
## [0.20.0](v0.19.0...v0.20.0) (2026-11-29) ### Features * animate widgets that a profile shows or hides ([#948](#948)) by @M4n0x ([eec8544](eec8544)), closes [#947](#947) [#947](#947) * log quit causes and show unexpected quits in Status ([#953](#953)) by @M4n0x ([ea5a64e](ea5a64e)), closes [#952](#952) ### Bug Fixes * choose a submenu item opened from the App menus tray ([#944](#944)) by @MaHofseth ([add49b0](add49b0)), closes [#942](#942) * draw borders in whole pixels so they keep every edge on 1x screens ([#934](#934)) by @M4n0x ([8590fcd](8590fcd)), closes [#933](#933) [#933](#933) * keep a package version installed when its folder is hidden ([#962](#962)) by @M4n0x ([2d97d15](2d97d15)), closes [#961](#961) * keep the Sound details open and smooth when picking a device ([#931](#931)) by @M4n0x ([df96453](df96453)), closes [#928](#928) [#928](#928) * keep windows clear of the bar after a double-click fills them ([#936](#936)) by @M4n0x ([c1478d1](c1478d1)), closes [#935](#935) [#935](#935) * leave the keyboard with the app while StableBar shows its menus ([#943](#943)) by @MaHofseth ([abc1c4f](abc1c4f)), closes [#941](#941) * play an app's first sound at its mixer volume ([#899](#899)) by @M4n0x ([2c38350](2c38350)), closes [#897](#897) [#897](#897) * show a turned-off widget's last output when it comes back ([#950](#950)) by @M4n0x ([6776fcb](6776fcb)), closes [#949](#949) [#949](#949) * show Countdown and Join in Settings after picking it ([#940](#940)) by @MaHofseth ([6ecaa72](6ecaa72)) * stop offering a package update that is already installed ([#956](#956)) by @M4n0x ([4592ebc](4592ebc))
|
🎉 This PR is included in version 0.20.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Problem
Fixes #933. On a screen that isn't Retina, a border whose width isn't a whole number of pixels loses part of its straight top and left edges. Setup's 0.5 pt cards have no top or left edge, Fern's 1.5 pt outline around a visible workspace has a gap along its top, and setup's selected card (2.5 pt) is a pixel thinner at the top and left.
Changes
pixelBorder(Bar/PixelBorder.swift):strokeBorderwith its width rounded to whole pixels, at least one when it's above zero, with aStrokeStyleform for dashed borders. It rounds only on screen. Offscreen drawings (CI's screens, Share My Bar's images) keep the width they're given, as onmain: they go through Core Graphics, which draws these borders evenly at any scale.strokeBordercalls: the built-in 0.5 pt edges (setup's cards and panels, glass controls, the bar editor's zones, the slider knob), a theme'sborderWidth(workspaces, widgets, groups, the bar, popups, popup boxes and the Settings theme cards) and Settings' own outlines. At 1x, 0.5 pt draws 1 pixel, 1.5 pt draws 2 and 2.5 pt draws 3. Retina screens draw the same widths as before. Integer widths don't change anywhere.ArchitectureRulesTests.bordersAreDrawnInWholePixelsallows nostrokeBorderoutsidePixelBorder.swift. The rule is a ban on the call rather than on0.5because theme widths arrive at runtime. Astrokecentred on the edge, like the bar editor's popover outline, draws evenly and is left alone. DECISIONS.md records it.docs/styling.mdsaysborderWidthis rounded to whole pixels.Before and after, on a 1x screen
Setup's cards, drawn by the app on a 1x macOS 27.2 screen from
mainand from this branch:Fern's visible-workspace outline (1.5 pt). On the left as now, with the gap along the top. In the middle with
pixelBorder, 2 px. On the right, 1 px, the other way to round:Setup's selected card (2.5 pt):
As reported, on a Dell U2722D at 1x:
The screens bot shouldn't show a change: CI draws its screens offscreen, where borders keep their width and were already even.
Testing
pixelBorderdraws the same rows on all four sides.PixelBorder.swift, from before review; its on-screen rounding hasn't changed.setup-choosescene in an on-screen window. That build was this fix's first form, which drew the same one-pixel border.mainand this branch before review. Offscreen borders now keep their exact width, the same call as onmain.setup-allow-aerospace-gapdiffered. Drawing it frommaintwice differed too: the bar's app name loads at different times.swift build --build-testsandswift testpass: 1459 Swift Testing and 293 XCTest.strokeBordercall.scripts/check.sh --quickandnpx commitlint --from origin/mainpass.Merging
A merge commit. The
fixcommit carries the change andFixes #933. Thetestcommit adds the rule and the decision.Claude Opus 5.5 via Claude Code