Repository navigation
fix: draw StableBar's bundled icon in Share My Bar and every other view - #900
Conversation
NSApplication's applicationIconImage depends on how macOS looks up the app's icon, and it can pick other artwork in two copies of the same app. CI draws screens from base.app and head.app, so Share My Bar's icon showed up as changed on pull requests that didn't touch it. StableBarIcon loads AppIcon.icns from the bundle and keeps one 512-pixel bitmap of its 256-point artwork. The scale is fixed rather than taken from the screen, so AppKit can't choose another size. Share My Bar, About, the setup card, the Accessibility guide, its drag image and the guide's scene all draw it. Without a bundle, it falls back to macOS's icon. Fixes #895
The architecture rules now allow applicationIconImage and applicationIconName only in StableBarIcon, so a new view can't bring back the screens that change between two builds. The check uses simple word boundaries: Unicode ones make NSApp.applicationIconImage one word, so the pattern would never match. Refs #895
Before and after
|
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/accessibility-guide-light
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-dark
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-landscape-dark
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-landscape-light
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-light
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-link-dark
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-link-light
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-macbook-dark
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/share-my-bar-macbook-light
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
253 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/app-menu-popup-dark, scenes/app-menu-popup-light, scenes/apple-menu-settings-dark, scenes/apple-menu-settings-light, scenes/apple-menu-symbol-bar-dark, scenes/apple-menu-symbol-bar-light, scenes/apple-menu-symbol-settings-dark, scenes/apple-menu-symbol-settings-light, scenes/bottom-bar-popup-dark, scenes/bottom-bar-popup-light, scenes/chat-popup-dark, scenes/chat-popup-light, scenes/crowded-edit-bar-dark, scenes/crowded-edit-bar-light, scenes/disk-meter-bar-dark, scenes/disk-meter-bar-light, scenes/dock-badges-bar-dark, scenes/dock-badges-bar-light, scenes/edit-bar-wide-group-dark, scenes/edit-bar-wide-group-light, scenes/essentials-clock-popup-dark, scenes/essentials-clock-popup-light, scenes/essentials-disk-popup-dark, scenes/essentials-disk-popup-light, scenes/filled-slider-popup-dark, scenes/filled-slider-popup-light, scenes/group-members-bar-dark, scenes/group-members-bar-light, scenes/gruvbox-bar-dark, scenes/gruvbox-bar-light, scenes/horizontal-list-popup-dark, scenes/horizontal-list-popup-light, 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/input-source-popup-light, scenes/labeled-metric-built-in-dark, scenes/labeled-metric-built-in-light, scenes/labeled-metric-catppuccin-dark, scenes/labeled-metric-catppuccin-light, scenes/meeting-live-popup-dark, scenes/meeting-live-popup-light, scenes/meeting-soon-bar-dark, scenes/meeting-soon-bar-light, scenes/menu-bar-items-widget-settings-dark, scenes/menu-bar-items-widget-settings-light, scenes/merged-status-bar-dark, scenes/merged-status-bar-light, scenes/notch-flare-bar-dark, scenes/notch-flare-bar-light, scenes/output-device-popup-dark, scenes/output-device-popup-light, scenes/popup-gap-bar-dark, scenes/popup-gap-bar-light, scenes/popup-spacing-bar-dark, scenes/popup-spacing-bar-light, scenes/popup-view-dark, scenes/popup-view-light, scenes/privacy-both-bar-dark, scenes/privacy-both-bar-light, scenes/privacy-hide-when-idle-bar-dark, scenes/privacy-hide-when-idle-bar-light, scenes/privacy-idle-bar-dark, scenes/privacy-idle-bar-light, scenes/privacy-microphone-bar-dark, scenes/privacy-microphone-bar-light, scenes/privacy-settings-dark, scenes/privacy-settings-light, scenes/reduce-transparency-bar-dark, scenes/reduce-transparency-bar-light, scenes/reduce-transparency-glass-bar-dark, scenes/reduce-transparency-glass-bar-light, scenes/ring-bar-dark, scenes/ring-bar-light, scenes/settings-bar-dark, scenes/settings-bar-light, scenes/settings-bar-link-dark, scenes/settings-bar-link-light, scenes/settings-bar-link-review-dark, scenes/settings-bar-link-review-light, scenes/settings-bar-look-dark, scenes/settings-bar-look-light, scenes/settings-bar-placement-bottom-dark, scenes/settings-bar-placement-bottom-light, scenes/settings-bar-placement-dark, scenes/settings-bar-placement-light, scenes/settings-calendar-picker-dark, scenes/settings-calendar-picker-light, scenes/settings-calendar-widget-dark, scenes/settings-calendar-widget-light, scenes/settings-crashes-dark, scenes/settings-crashes-light, scenes/settings-disk-widget-dark, scenes/settings-disk-widget-light, scenes/settings-feedback-dark, scenes/settings-feedback-light, scenes/settings-general-dark, scenes/settings-general-light, scenes/settings-general-macos15-dark, scenes/settings-general-macos15-light, scenes/settings-general-macos27-dark, scenes/settings-general-macos27-light, scenes/settings-general-move-dark, scenes/settings-general-move-failed-dark, scenes/settings-general-move-failed-light, scenes/settings-general-move-light, scenes/settings-general-move-moving-dark, scenes/settings-general-move-moving-light, scenes/settings-general-move-replace-dark, scenes/settings-general-move-replace-light, scenes/settings-general-setup-open-dark, scenes/settings-general-setup-open-light, scenes/settings-general-spaces-dark, scenes/settings-general-spaces-light, scenes/settings-general-yabai-gap-dark, scenes/settings-general-yabai-gap-light, scenes/settings-group-dark, scenes/settings-group-defaults-dark, scenes/settings-group-defaults-light, scenes/settings-group-light, scenes/settings-group-theme-color-dark, scenes/settings-group-theme-color-light, scenes/settings-help-dark, scenes/settings-help-light, scenes/settings-help-starred-dark, scenes/settings-help-starred-light, scenes/settings-labeled-metric-dark, scenes/settings-labeled-metric-light, scenes/settings-narrow-dark, scenes/settings-narrow-light, scenes/settings-package-dark, scenes/settings-package-light, scenes/settings-package-widget-dark, scenes/settings-package-widget-light, scenes/settings-profiles-conditions-dark, scenes/settings-profiles-conditions-light, scenes/settings-profiles-dark, scenes/settings-profiles-groups-dark, scenes/settings-profiles-groups-light, scenes/settings-profiles-light, scenes/settings-profiles-theme-dark, scenes/settings-profiles-theme-light, scenes/settings-store-dark, scenes/settings-store-light, scenes/settings-theme-dark, scenes/settings-theme-edits-dark, scenes/settings-theme-edits-light, scenes/settings-theme-groups-dark, scenes/settings-theme-groups-light, scenes/settings-theme-light, scenes/settings-theme-link-dark, scenes/settings-theme-link-light, scenes/settings-theme-origins-dark, scenes/settings-theme-origins-light, scenes/settings-theme-versions-dark, scenes/settings-theme-versions-light, scenes/settings-tiled-dark, scenes/settings-tiled-light, scenes/settings-tiled-narrowest-dark, scenes/settings-tiled-narrowest-light, scenes/settings-uninstall-dark, scenes/settings-uninstall-failed-dark, scenes/settings-uninstall-failed-light, scenes/settings-uninstall-light, 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/settings-workspace-hidden-light, scenes/setup-look-below-menu-bar-dark, scenes/setup-look-dark, scenes/setup-look-no-notch-dark, scenes/setup-look-suggestions-dark, scenes/setup-move-existing-dark, scenes/setup-move-failed-dark, scenes/setup-move-ready-dark, scenes/setup-move-replace-dark, scenes/setup-omniwm-connection-dark, scenes/setup-permissions-dark, scenes/setup-permissions-macos27-dark, scenes/setup-permissions-spaces-dark, and 53 more
Visual review: 10 changed screens approved.
…gh AppKit On CI's macOS 26 runner, AppKit chose the 256-pixel bitmap even when asked for 2x artwork, while a Retina Mac on macOS 27 got the 512-pixel one. StableBarIcon now picks the smallest bitmap of at least 512 pixels from AppIcon.icns itself, so the screen and the macOS version can't change which artwork the scenes draw. Refs #895
An image made from a CGImage reported 256 pixels on a 1x screen, such as CI's runner, though it held the 512-pixel bitmap: its snapshot representation follows the screen. StableBarIcon now adds the file's bitmap itself to the image, which reports 512 pixels on any screen. It draws the same pixels as before, on a 1x and a 2x screen alike. Refs #895
|
🎉 This PR is included in version 0.19.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |






























Problem
On #894, which doesn't touch Share My Bar, the screens bot reported all 8 Share My Bar screens as changed. Only the edge antialiasing of StableBar's icon differed.
applicationIconImagedepends on macOS's icon lookup, which can pick other artwork inbase.appandhead.app. #625 fixed this only for the Accessibility guide's scene.Fixes #895
Changes
StableBarIcon(App/StableBarIcon.swift) loadsAppIcon.icnsfrom the bundle and keeps its 512-pixel bitmap as a 256-point image. Without a bundle, it falls back toapplicationIconImage.cgImage(forProposedRect:)without a context, as in build: draw the Accessibility guide with its bundled icon #625, picks 512 pixels on a Retina Mac, and an image made withNSImage(cgImage:size:)reports 256 pixels on a 1× screen, as on CI's runner, though it holds the 512-pixel bitmap.StableBarIcon.image.AccessibilityGuideViewloses itsiconparameter, which only the scene set.stableBarIconHasOneSourceinArchitectureRulesTestsfails whenapplicationIconImageorapplicationIconNameappears in code outsideStableBarIcon. It uses simple word boundaries: with Swift's default Unicode ones,NSApp.applicationIconImageis one word, and the pattern suggested in the issue passed against all five uses onmain.theIconCheckFindsTheIconMacOSLooksUpchecks that the check finds them.It's named
StableBarIconrather thanAppIconbecause #889 addsAppIcons, for other apps' icons on the bar. No configuration change.Testing
swift build --build-tests. The new tests failed before the fix (5 files flagged, no artwork loaded) and pass now.stableBarIconDrawsOneSizeOfItsArtworkfailed on CI's runner for the first two versions of the helper. A macOS 26.6 VM with a 1× display reproduced that, runningStableBarIcon.swiftcompiled with a harness that repeats the test's checks: the second version gave 256 pixels there, and the final one gives 512 on the VM and on a 2× Mac. Drawn at 44 points into a 2× bitmap, both versions give the same pixels on both screens.scripts/check.sh --quickpasses.Full
swift teston macOS 27.2: 1,362 of 1,363 pass.workspaceLabelsFollowTheBarFromLightToDarkfails the same way on this Mac with unchangedmain.On a Retina Mac with macOS 27.2, with the final helper, drew
share-my-bar*andaccessibility-guidein light and dark (10 screens) with--render-scenes, from debug builds bundled withscripts/build.sh, and compared them with.github/scripts/compare-screens.mjs:base.appandhead.app, two copies of this branchhead.appand a copy with the icon from ed5070emainand this branchI didn't reproduce the intermittent difference between two builds of
mainlocally; it shows up in some runs on CI'smacos-26runner (7 of 55 in the audit on build: draw the Accessibility guide with its bundled icon #625).The setup card and About have no scene. About's header, the part with the icon, isn't shown anywhere: Settings uses only
AboutView's rows.Share My Bar's badge, from
mainand from this branch (share-my-barscene, 2× crop):The artwork is the same; only the edge antialiasing differs. Because this pull request changes how the icon is drawn, the screens bot should report the 8 Share My Bar screens as changed this once, inside the icon. On CI, the Accessibility guide is likely to change too, from 256- to 512-pixel artwork. Later pull requests draw the bundled artwork on both sides.
Merging
Merge commit: three
fixcommits for the icon and atestcommit for the check. Thefixcommits make a release. A squash with the firstfixcommit's message would leave one changelog entry instead of three.Claude Opus 5.5 via Claude Code in T3 Code