Skip to content

fix: draw borders in whole pixels so they keep every edge on 1x screens - #934

Merged
M4n0x merged 2 commits into
mainfrom
fix/one-pixel-borders
Nov 25, 2026
Merged

M4n0x merged 2 commits into
mainfrom
fix/one-pixel-borders

Conversation

@M4n0x

@M4n0x M4n0x commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

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): strokeBorder with its width rounded to whole pixels, at least one when it's above zero, with a StrokeStyle form 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 on main: they go through Core Graphics, which draws these borders evenly at any scale.
  • Every border goes through it. That's all 89 strokeBorder calls: the built-in 0.5 pt edges (setup's cards and panels, glass controls, the bar editor's zones, the slider knob), a theme's borderWidth (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.
  • A rule: ArchitectureRulesTests.bordersAreDrawnInWholePixels allows no strokeBorder outside PixelBorder.swift. The rule is a ban on the call rather than on 0.5 because theme widths arrive at runtime. A stroke centred on the edge, like the bar editor's popover outline, draws evenly and is left alone. DECISIONS.md records it.
  • Docs: docs/styling.md says borderWidth is 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 main and from this branch:

Setup's cards before (top and left edges missing) and after (even)

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:

Fern's workspace outline: 1.5 px with a gap, 2 px even, 1 px even

Setup's selected card (2.5 pt):

Selected card: thinner top and left before, even after

As reported, on a Dell U2722D at 1x:

Setup's cards on a 1x display Fern's workspace outline on the bar, enlarged

The screens bot shouldn't show a change: CI draws its screens offscreen, where borders keep their width and were already even.

Testing

  • Reproduced on screen in a macOS 27.2 VM with a 1x display, measuring each edge's pixels.
    • Setup's 0.5 pt cards: no line at the top or left, a line at the bottom and right.
    • Fern's 1.5 pt outline: 1 row at the top, 2 at the bottom.
    • Every pixelBorder draws the same rows on all four sides.
  • How the images were made:
    • The workspace and selected-card images come from a harness compiled with this branch's PixelBorder.swift, from before review; its on-screen rounding hasn't changed.
    • The setup images come from the app itself, drawing the setup-choose scene in an on-screen window. That build was this fix's first form, which drew the same one-pixel border.
  • Scenes: all 188 scenes, drawn as on CI (offscreen, on a 1x screen), were byte-identical between main and this branch before review. Offscreen borders now keep their exact width, the same call as on main.
    • In one run, setup-allow-aerospace-gap differed. Drawing it from main twice differed too: the bar's app name loads at different times.
  • Tests and checks:
    • swift build --build-tests and swift test pass: 1459 Swift Testing and 293 XCTest.
    • The new rule fails on a probe strokeBorder call.
    • scripts/check.sh --quick and npx commitlint --from origin/main pass.
  • Not checked:
    • The real bar with AeroSpace on a 1x screen; the workspace outline was checked with the harness above.
    • Settings on a 1x screen by eye.

Merging

A merge commit. The fix commit carries the change and Fixes #933. The test commit adds the rule and the decision.

Claude Opus 5.5 via Claude Code

@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner November 25, 2026 13:38

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread DECISIONS.md Resolved
Comment thread Sources/StableBar/Bar/PixelBorder.swift Resolved
Comment thread Sources/StableBar/Bar/PixelBorder.swift Resolved
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
@M4n0x
M4n0x force-pushed the fix/one-pixel-borders branch from 7c80b83 to baf8453 Compare November 25, 2026 13:47
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Before and after

main at 1552607 → this pull request at baf8453 · 202 screens drawn · 0 changed

202 unchanged screens

docs/essentials-clock-settings-dark, docs/essentials-clock-settings-light, docs/essentials-dark, docs/essentials-light, docs/essentials-settings-dark, docs/essentials-settings-light, docs/hero-dark, docs/hero-light, docs/popups-dark, docs/popups-light, docs/settings-dark, docs/settings-light, docs/themes-dark, docs/themes-light, scenes/accessibility-guide-dark, scenes/app-menu-popup-dark, scenes/apple-menu-settings-dark, scenes/apple-menu-symbol-bar-dark, scenes/apple-menu-symbol-settings-dark, scenes/bar-dividers-dark, scenes/bottom-bar-popup-dark, scenes/chat-popup-dark, scenes/crowded-edit-bar-dark, scenes/disk-meter-bar-dark, scenes/dock-badges-bar-dark, scenes/edit-bar-wide-group-dark, scenes/essentials-clock-popup-dark, scenes/essentials-disk-popup-dark, scenes/filled-slider-popup-dark, scenes/glass-text-follows-background-bar-dark, scenes/glass-text-follows-background-bar-light, scenes/group-members-bar-dark, scenes/group-others-bar-dark, scenes/group-text-color-bar-dark, scenes/gruvbox-bar-dark, scenes/gruvbox-bar-light, scenes/horizontal-list-popup-dark, scenes/increase-contrast-bar-dark, scenes/increase-contrast-bar-light, scenes/increase-contrast-popup-dark, scenes/increase-contrast-popup-light, scenes/input-source-popup-dark, scenes/labeled-metric-built-in-dark, scenes/labeled-metric-catppuccin-dark, scenes/labeled-metric-catppuccin-light, scenes/meeting-live-popup-dark, scenes/meeting-soon-bar-dark, scenes/menu-bar-items-widget-settings-dark, scenes/menu-bar-items-widget-style-dark, scenes/merged-status-bar-dark, scenes/notch-flare-bar-dark, scenes/output-device-popup-dark, scenes/package-template-clash-bar-dark, scenes/popup-gap-bar-dark, scenes/popup-spacing-bar-dark, scenes/popup-view-dark, scenes/preset-dashboard-bar-dark, scenes/preset-developer-bar-dark, scenes/preset-everyday-bar-dark, scenes/preset-minimal-bar-dark, scenes/preset-workday-bar-dark, scenes/privacy-both-bar-dark, scenes/privacy-hide-when-idle-bar-dark, scenes/privacy-idle-bar-dark, scenes/privacy-microphone-bar-dark, scenes/privacy-settings-dark, scenes/quick-toggles-bar-dark, scenes/quick-toggles-displays-popup-dark, scenes/quick-toggles-every-tile-popup-dark, scenes/quick-toggles-network-popup-dark, scenes/quick-toggles-networks-popup-dark, scenes/quick-toggles-popup-dark, scenes/reduce-transparency-bar-dark, scenes/reduce-transparency-bar-light, scenes/reduce-transparency-glass-bar-dark, scenes/reduce-transparency-glass-bar-light, scenes/reduce-transparency-text-follows-background-bar-dark, scenes/reduce-transparency-text-follows-background-bar-light, scenes/ring-bar-dark, scenes/settings-bar-dark, scenes/settings-bar-link-dark, scenes/settings-bar-link-review-dark, scenes/settings-bar-link-workspace-color-dark, scenes/settings-bar-look-dark, scenes/settings-bar-look-light, scenes/settings-bar-placement-bottom-dark, scenes/settings-bar-placement-dark, scenes/settings-calendar-picker-dark, scenes/settings-calendar-widget-dark, scenes/settings-clock-widget-dark, scenes/settings-crashes-dark, scenes/settings-disk-widget-dark, scenes/settings-feedback-dark, scenes/settings-general-dark, scenes/settings-general-kiwidesk-dark, scenes/settings-general-macos15-dark, scenes/settings-general-macos27-dark, scenes/settings-general-manager-not-found-dark, scenes/settings-general-move-dark, scenes/settings-general-move-failed-dark, scenes/settings-general-move-moving-dark, scenes/settings-general-move-replace-dark, scenes/settings-general-setup-open-dark, scenes/settings-general-spaces-dark, scenes/settings-general-yabai-gap-dark, scenes/settings-group-dark, scenes/settings-group-defaults-dark, scenes/settings-group-defaults-light, scenes/settings-group-theme-color-dark, scenes/settings-group-theme-color-light, scenes/settings-help-dark, scenes/settings-help-starred-dark, scenes/settings-labeled-metric-dark, scenes/settings-narrow-dark, scenes/settings-package-dark, scenes/settings-package-widget-dark, scenes/settings-profiles-conditions-dark, scenes/settings-profiles-dark, scenes/settings-profiles-groups-dark, scenes/settings-profiles-theme-dark, scenes/settings-quick-toggles-dark, scenes/settings-store-dark, scenes/settings-theme-dark, scenes/settings-theme-edits-dark, scenes/settings-theme-edits-light, scenes/settings-theme-groups-dark, scenes/settings-theme-light, scenes/settings-theme-link-dark, scenes/settings-theme-link-light, scenes/settings-theme-origins-dark, scenes/settings-theme-versions-dark, scenes/settings-tiled-dark, scenes/settings-tiled-narrowest-dark, scenes/settings-uninstall-dark, scenes/settings-uninstall-failed-dark, scenes/settings-widget-backgrounds-dark, scenes/settings-widget-backgrounds-light, scenes/settings-widget-colors-dark, scenes/settings-widget-colors-light, scenes/settings-widget-style-theme-edits-dark, scenes/settings-widget-style-theme-edits-light, scenes/settings-workspace-hidden-dark, scenes/setup-allow-aerospace-gap-dark, scenes/setup-allow-automation-dark, scenes/setup-allow-below-menu-bar-dark, scenes/setup-allow-dark, scenes/setup-allow-dot-dark, scenes/setup-allow-macos27-dark, scenes/setup-allow-offline-dark, scenes/setup-allow-spaces-dark, scenes/setup-allow-workday-dark, scenes/setup-choose-dark, scenes/setup-choose-new-dark, scenes/setup-choose-no-battery-dark, scenes/setup-done-dark, scenes/setup-intro-dark, scenes/setup-intro-wallpaper-dark, scenes/setup-move-existing-dark, scenes/setup-move-failed-dark, scenes/setup-move-ready-dark, scenes/setup-move-replace-dark, scenes/shadow-offsets-bar-dark, scenes/shadow-offsets-bar-light, scenes/share-my-bar-dark, scenes/share-my-bar-dock-dark, scenes/share-my-bar-glass-dark, scenes/share-my-bar-glass-light, scenes/share-my-bar-landscape-dark, scenes/share-my-bar-link-dark, scenes/share-my-bar-macbook-dark, scenes/share-my-bar-post-dark, scenes/slider-end-stop-popup-dark, scenes/sound-details-popup-dark, scenes/stablebar-widget-bar-dark, scenes/stablebar-widget-settings-dark, scenes/starter-bar-dark, scenes/starter-edit-bar-dark, scenes/symbol-variants-bar-dark, scenes/system-monitor-memory-bar-dark, scenes/system-monitor-shows-settings-dark, scenes/system-monitor-split-warning-bar-dark, scenes/text-follows-background-bar-dark, scenes/text-follows-background-bar-light, scenes/themed-slider-inline-dark, scenes/themed-slider-inline-light, scenes/themed-slider-popup-dark, scenes/themed-slider-popup-light, scenes/themed-slider-tooltip-dark, scenes/themed-slider-tooltip-light, scenes/tinted-app-icons-bar-dark, scenes/tinted-app-icons-bar-light, scenes/tinted-image-bar-dark, scenes/tinted-image-bar-light, scenes/update-popup-dark, scenes/update-popup-star-github-cli-dark, scenes/update-popup-star-thanks-dark, scenes/workspace-badges-bar-dark, scenes/workspace-cells-bar-dark, scenes/workspace-focused-window-bar-dark, scenes/workspace-focused-window-padding-bar-dark, and 2 more

Visual review: 202 screens, none changed.

@M4n0x
M4n0x added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 8590fcd Nov 25, 2026
26 checks passed
@M4n0x
M4n0x deleted the fix/one-pixel-borders branch November 25, 2026 14:40
stablebar-releases Bot pushed a commit that referenced this pull request Nov 29, 2026
## [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))
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.20.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thin borders lose their top and left edges on screens that aren't Retina

1 participant