Skip to content

fix: draw StableBar's bundled icon in Share My Bar and every other view - #900

Merged
M4n0x merged 4 commits into
mainfrom
fix/895-one-icon-source
Nov 22, 2026
Merged

M4n0x merged 4 commits into
mainfrom
fix/895-one-icon-source

Conversation

@M4n0x

@M4n0x M4n0x commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

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. applicationIconImage depends on macOS's icon lookup, which can pick other artwork in base.app and head.app. #625 fixed this only for the Accessibility guide's scene.

Fixes #895

Changes

  • One source for the icon. StableBarIcon (App/StableBarIcon.swift) loads AppIcon.icns from the bundle and keeps its 512-pixel bitmap as a 256-point image. Without a bundle, it falls back to applicationIconImage.
  • A fixed size. It takes that bitmap from the file's representations itself and makes it the image's only representation. AppKit's own choices follow the screen: 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 with NSImage(cgImage:size:) reports 256 pixels on a 1× screen, as on CI's runner, though it holds the 512-pixel bitmap.
  • Every use replaced. Share My Bar's badge, About, the setup card, the Accessibility guide, its drag image and the guide's scene draw StableBarIcon.image. AccessibilityGuideView loses its icon parameter, which only the scene set.
  • A check so it stays fixed. stableBarIconHasOneSource in ArchitectureRulesTests fails when applicationIconImage or applicationIconName appears in code outside StableBarIcon. It uses simple word boundaries: with Swift's default Unicode ones, NSApp.applicationIconImage is one word, and the pattern suggested in the issue passed against all five uses on main. theIconCheckFindsTheIconMacOSLooksUp checks that the check finds them.
  • DECISIONS.md's Architecture rules are tests entry lists the new check.

It's named StableBarIcon rather than AppIcon because #889 adds AppIcons, 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. stableBarIconDrawsOneSizeOfItsArtwork failed on CI's runner for the first two versions of the helper. A macOS 26.6 VM with a 1× display reproduced that, running StableBarIcon.swift compiled 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 --quick passes.

  • Full swift test on macOS 27.2: 1,362 of 1,363 pass. workspaceLabelsFollowTheBarFromLightToDark fails the same way on this Mac with unchanged main.

  • On a Retina Mac with macOS 27.2, with the final helper, drew share-my-bar* and accessibility-guide in light and dark (10 screens) with --render-scenes, from debug builds bundled with scripts/build.sh, and compared them with .github/scripts/compare-screens.mjs:

    Comparison Result
    base.app and head.app, two copies of this branch all 10 byte-identical
    head.app and a copy with the icon from ed5070e all 10 changed, only inside the icon (842–1,532 pixels)
    main and this branch the 8 Share My Bar screens changed, only inside the icon (790–1,065 pixels); the guide unchanged
  • I didn't reproduce the intermittent difference between two builds of main locally; it shows up in some runs on CI's macos-26 runner (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 main and from this branch (share-my-bar scene, 2× crop):

Appearance Before After
Dark Share My Bar badge before, dark Share My Bar badge after, dark
Light Share My Bar badge before, light Share My Bar badge after, light
Dark, enlarged 6× Icon before, enlarged Icon after, enlarged

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 fix commits for the icon and a test commit for the check. The fix commits make a release. A squash with the first fix commit's message would leave one changelog entry instead of three.

Claude Opus 5.5 via Claude Code in T3 Code

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
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner November 22, 2026 11:29

@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.

No issues found across 9 files

Re-trigger cubic

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Before and after

main at 1cb5b24 → this pull request at d876411 · 263 screens drawn · 10 changed

Screen Change Where (image pixels)
scenes/accessibility-guide-dark 716 pixels 96,150 · 40×40
scenes/accessibility-guide-light 592 pixels 96,150 · 40×40
scenes/share-my-bar-dark 782 pixels 1143,454 · 39×37
scenes/share-my-bar-landscape-dark 677 pixels 1108,716 · 32×33
scenes/share-my-bar-landscape-light 710 pixels 1107,716 · 34×34
scenes/share-my-bar-light 832 pixels 1141,452 · 41×39
scenes/share-my-bar-link-dark 803 pixels 1143,694 · 35×38
scenes/share-my-bar-link-light 850 pixels 1141,693 · 41×41
scenes/share-my-bar-macbook-dark 782 pixels 1143,454 · 39×37
scenes/share-my-bar-macbook-light 832 pixels 1141,452 · 41×39

scenes/accessibility-guide-dark

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/accessibility-guide-light

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-dark

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-landscape-dark

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-landscape-light

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-light

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-link-dark

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-link-light

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-macbook-dark

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/share-my-bar-macbook-light

Before After
Before After

Difference, changed pixels in red:

Difference

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
@M4n0x M4n0x added the visual-ok A maintainer looked at the changed screens and approves them label Nov 22, 2026
@M4n0x
M4n0x added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit c478e2d Nov 22, 2026
27 checks passed
@M4n0x
M4n0x deleted the fix/895-one-icon-source branch November 22, 2026 12:33
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.19.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

released visual-ok A maintainer looked at the changed screens and approves them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StableBar's icon shows up as changed in Share My Bar screens on unrelated pull requests

1 participant