Skip to content

fix: keep workspace numbers in step with the bar's light or dark appearance - #672

Merged
M4n0x merged 1 commit into
mainfrom
fix/669-workspace-numbers-appearance
Nov 15, 2026
Merged

M4n0x merged 1 commit into
mainfrom
fix/669-workspace-numbers-appearance

Conversation

@M4n0x

@M4n0x M4n0x commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

With AeroSpace, workspace numbers can keep their Light colours after the bar turns Dark. On Fern, the focused number turned white on the green fill instead of dark green. Fixes #669.

Changes

Each workspace cell, and each app icon in it, draws its content in a hosting view of its own, fed a copy of the bar's environment in updateNSView. SwiftUI calls updateNSView again only for the environment values it read there, and nothing read the colour scheme. So after a switch from Light to Dark the copy stayed Light, while the fills, drawn outside those views, switched.

  • New NSViewRepresentableContext.nestedEnvironment (WidgetDragView.swift) returns the context's environment after reading its colour scheme and contrast, so SwiftUI calls updateNSView when either changes.
  • The four representables that copy the environment into a nested hosting view use it: workspace drop targets and drag sources, the equalizer and scrolling text.
  • Contrast is included because Increase Contrast changes the appearance the same way.

Testing

  • New workspaceLabelsFollowTheBarFromLightToDark draws a focused cell whose number is red in Light and green in Dark, in a window that starts Light and turns Dark, and counts the pixels of each. It fails on main (the number stays red) and passes with the fix, three runs out of three. It waits by counted run-loop polls.
  • swift test --filter 'Workspace|workspace|Equalizer|equalizer|Scrolling|scrolling|NativePresentation|WidgetDrag|nowPlaying|NowPlaying': 119 Swift Testing and 39 XCTest cases pass. The full suite is left to CI.
  • scripts/check.sh --quick and --commits pass.
  • Live: a long-running bar on Fern showed the white number below. After the bar restarted it drew the number correctly, and what had switched that bar from Light to Dark isn't known, so the fix wasn't checked against that exact trigger.
  • Not checked: the equalizer and scrolling text after a switch, and Increase Contrast.

The screens bot can't show this change: scenes draw one appearance and never switch it. These images come from an offscreen window, first drawn in Light (top row), switched to Dark (middle), then with focus on an empty workspace (bottom):

Before: numbers keep Light colours on Dark. After: they follow Dark.

The live bar before the fix:

Focused empty workspace 4 with a white number on Fern

Merging

One commit; any merge method works, and a squash keeps its fix: title.

Claude Opus 5.5 via Claude Code

…arance

With AeroSpace, each workspace cell draws its content in a hosting view of its own, fed a copy
of the bar's environment in updateNSView. SwiftUI calls updateNSView again only for the
environment values it read there, so switching the bar from Light to Dark left the copy in
Light, and numbers kept their Light colours on Dark fills, such as a white number on Fern's
green focus. Read the colour scheme and contrast when handing the environment on, in the
workspace cells and icons and in the equalizer and scrolling text, which copy it the same way.

Closes #669
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner November 15, 2026 09:59
@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Representable hosted content now receives an environment that reads color scheme and contrast. A workspace drag test checks that label colors change when the window switches from Aqua to Dark Aqua.

Changes: Hosted appearance updates

Layer / File(s) Summary
Track appearance in hosted environments
Sources/StableBar/WidgetDragView.swift, Sources/StableBar/WorkspaceWindowDrag.swift, Sources/StableBar/Equalizer.swift, Sources/StableBar/ScrollingText.swift
Adds nestedEnvironment, which reads color scheme and contrast, and uses it for hosted content in the workspace drag views, equalizer, and scrolling text.
Verify workspace label appearance
Tests/StableBarTests/WorkspaceWindowDragTests.swift
Adds a test that checks workspace label colors before and after switching from Aqua to Dark Aqua. The test also checks that drop targets are present.

Severity of issue fixed: Low

Merge Risk: Minimal · up to e69eb

Workspace numbers, the equalizer and scrolling text should now follow the bar's Light or Dark appearance. No concrete merge-blocking risk was found. The live trigger that switched the bar to Dark was not reproduced, so a quick manual check after merge is sensible.

Pre-merge checks: Passed 3

Check name Status Explanation
Description check Passed The description follows the repository template. It has a clear Problem section that cites issue #669, a Changes section that explains the root cause and the fix, and a detailed Testing section. The T…
Linked Issues check Passed Issue #669 requires workspace numbers to follow the bar's appearance when it switches from Light to Dark, and to stay correct through later focus changes. The diagnosis names four nested hosting views…
Out of Scope Changes check Passed All changed files map to issue #669. WidgetDragView.swift adds the shared nestedEnvironment helper. WorkspaceWindowDrag.swift, Equalizer.swift, and ScrollingText.swift each switch one environment inje…
Full details: Description check

Explanation

The description follows the repository template. It has a clear Problem section that cites issue #669, a Changes section that explains the root cause and the fix, and a detailed Testing section. The Testing section lists the commands run, the results, and the checks not performed (equalizer and scrolling text after a switch, and Increase Contrast). The Merging section states the merge method. The description ends with the model and harness line, Claude Opus 5.5 via Claude Code, which the template requires as the last line. All required sections are present and substantively filled in.

Full details: Linked Issues check

Explanation

Issue #669 requires workspace numbers to follow the bar's appearance when it switches from Light to Dark, and to stay correct through later focus changes. The diagnosis names four nested hosting views that copy the environment without observing colour scheme: WorkspaceWindowDropTarget.updateNSView, WorkspaceWindowDragSource.updateNSView (app icons), EqualizerLayer, and ScrollingTextLayer. At the reviewed head, WidgetDragView.swift adds NSViewRepresentableContext.nestedEnvironment, which reads environment.colorScheme and colorSchemeContrast before returning the environment. WorkspaceWindowDrag.swift (both representables) and the equalizer and scrolling text now pass context.nestedEnvironment instead of context.environment. Reading these values in updateNSView makes SwiftUI call updateNSView on a scheme or contrast change, so the nested copy refreshes. Focus changes already trigger updateNSView, so later focus changes stay correct. The added test workspaceLabelsFollowTheBarFromLightToDark is described in the summary; I did not execute it. The live trigger for the Fern observation is unknown, and the equalizer, scrolling text, and Increase Contrast were not checked live. These gaps concern verification, not the coding requirement, which the code change covers.

Full details: Out of Scope Changes check

Explanation

All changed files map to issue #669. WidgetDragView.swift adds the shared nestedEnvironment helper. WorkspaceWindowDrag.swift, Equalizer.swift, and ScrollingText.swift each switch one environment injection to that helper, a two-line change each. WorkspaceWindowDragTests.swift adds the regression test for the Light-to-Dark switch. No unrelated behaviour changes appear in the reviewed diffs. The PR description's contrast handling is the same mechanism applied to colorSchemeContrast, which the issue's appearance scope covers.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8c78bd4 and e69eb11.

Files selected for processing: 5

  • Sources/StableBar/Equalizer.swift
  • Sources/StableBar/ScrollingText.swift
  • Sources/StableBar/WidgetDragView.swift
  • Sources/StableBar/WorkspaceWindowDrag.swift
  • Tests/StableBarTests/WorkspaceWindowDragTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Before and after

main at 8c78bd4 → this pull request at e69eb11 · 156 screens drawn in one CI job · 0 changed

156 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/accessibility-guide-light, scenes/app-menu-popup-dark, scenes/app-menu-popup-light, scenes/apple-menu-settings-dark, scenes/apple-menu-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/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/filled-slider-popup-dark, scenes/filled-slider-popup-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/notch-flare-bar-dark, scenes/notch-flare-bar-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/settings-bar-dark, scenes/settings-bar-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-crashes-dark, scenes/settings-crashes-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-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-help-dark, scenes/settings-help-light, scenes/settings-help-starred-dark, scenes/settings-help-starred-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-theme-dark, scenes/settings-theme-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-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-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-spaces-dark, scenes/setup-permissions-spaces-ready-dark, scenes/setup-placement-bottom-dark, scenes/setup-placement-dark, scenes/setup-touches-dark, scenes/setup-touches-macos15-dark, scenes/setup-touches-spaces-dark, scenes/setup-try-dark, scenes/setup-yabai-connection-dark, scenes/slider-end-stop-popup-dark, scenes/slider-end-stop-popup-light, scenes/stablebar-widget-bar-dark, scenes/stablebar-widget-bar-light, scenes/stablebar-widget-settings-dark, scenes/stablebar-widget-settings-light, scenes/starter-bar-dark, scenes/starter-bar-light, scenes/starter-edit-bar-dark, scenes/starter-edit-bar-light, scenes/symbol-variants-bar-dark, scenes/symbol-variants-bar-light, scenes/system-monitor-memory-bar-dark, scenes/system-monitor-memory-bar-light, scenes/system-monitor-shows-settings-dark, scenes/system-monitor-shows-settings-light, scenes/system-monitor-split-warning-bar-dark, scenes/system-monitor-split-warning-bar-light, scenes/update-popup-dark, scenes/update-popup-light, scenes/update-popup-star-github-cli-dark, scenes/update-popup-star-github-cli-light, scenes/update-popup-star-thanks-dark, scenes/update-popup-star-thanks-light, scenes/workspace-badges-bar-dark, scenes/workspace-badges-bar-light, scenes/workspace-focused-window-bar-dark, scenes/workspace-focused-window-bar-light, scenes/workspace-focused-window-padding-bar-dark, scenes/workspace-focused-window-padding-bar-light, scenes/workspace-hidden-apps-bar-dark, scenes/workspace-hidden-apps-bar-light

Visual review: 156 screens, none changed.

@M4n0x
M4n0x merged commit 3866e2c into main Nov 15, 2026
15 checks passed
@M4n0x
M4n0x deleted the fix/669-workspace-numbers-appearance branch November 15, 2026 10:59
stablebar-releases Bot pushed a commit that referenced this pull request Nov 16, 2026
## [0.16.0](v0.15.0...v0.16.0) (2026-11-16)

### Features

* add a built-in Disk widget with a popup to eject drives ([#680](#680)) by @M4n0x ([de1cb14](de1cb14)), closes [#222](#222)
* add a ring block and combine providers for compact status widgets ([#699](#699)) by @Seb-GRAF ([e05956c](e05956c))
* delete a profile from Settings → Profiles ([#668](#668)) by @M4n0x ([c2d43d4](c2d43d4)), closes [#667](#667)
* let a popup slider draw as a filled pill in the theme's colors ([#644](#644)) by @M4n0x ([f0d2f2c](f0d2f2c)), closes [#642](#642) [#642](#642)
* let a symbol fill, or take another variant, while a state is active ([#650](#650)) by @M4n0x ([b57ad13](b57ad13)), closes [#649](#649)
* match profiles to the theme the bar is drawn with ([#697](#697)) by @M4n0x ([8e98afd](8e98afd))
* open themes from stablebar links to try and install them ([#683](#683)) by @M4n0x ([b45ecee](b45ecee))
* share one padding, spacing and gap across popups ([#665](#665)) by @M4n0x ([65c6a73](65c6a73)), closes [#664](#664)
* show a menu bar item on the bar as macOS draws it ([#640](#640)) by @Jonathanm10 ([47a0286](47a0286)), closes [#639](#639)
* show Disk Utility's free space and offer a meter on the Disk widget ([#688](#688)) by @M4n0x ([6c3c16b](6c3c16b))
* undo, find and keep quotes straight when editing as JSON ([#685](#685)) by @M4n0x ([4066c68](4066c68))

### Bug Fixes

* keep a workspace switch from redrawing every widget on the bar by @M4n0x ([e5a4ebb](e5a4ebb)), closes [#670](#670)
* keep popups under the bar when their shadow reaches into the menu bar by @M4n0x ([ba2edab](ba2edab)), closes [#643](#643)
* keep the shadow margin of hover controls and trays from catching clicks on the bar ([#661](#661)) by @M4n0x ([8196fd9](8196fd9)), closes [#660](#660)
* keep the update popup on the newest release while an update waits ([#654](#654)) by @M4n0x ([8c78bd4](8c78bd4)), closes [#653](#653)
* keep workspace numbers in step with the bar's light or dark appearance ([#672](#672)) by @M4n0x ([3866e2c](3866e2c)), closes [#669](#669)
* leave Option-key alternates out of app menus ([#655](#655)) by [@amar9elbeg](https://github.com/amar9elbeg) ([f65703c](f65703c))
* open menu bar items on the bar on right-click and keep Edit Widget… on the grid symbol ([#663](#663)) by @M4n0x ([10c09ef](10c09ef)), closes [#662](#662) [#662](#662)
* reopen an app when OmniWM can't focus a window it still lists by @Jonathanm10 ([5dda2f4](5dda2f4)), closes [#651](#651)
* show a dropped workspace connection in Settings while reconnecting ([#694](#694)) by @Jonathanm10 ([f630ba8](f630ba8)), closes [#693](#693)
* stop a closed Settings window from redrawing with every bar update ([#674](#674)) by @M4n0x ([77b5383](77b5383)), closes [#671](#671)
* stop crafted tokens and settings from freezing StableBar while it loads ([#678](#678)) by @M4n0x ([435881d](435881d))
* warn only the part of a System monitor that is over its threshold ([#646](#646)) by @M4n0x ([388115b](388115b)), closes [#645](#645) [#645](#645)

### Performance Improvements

* tell whether a display has workspaces without filtering their windows by @M4n0x ([391b899](391b899))
@stablebar-releases

Copy link
Copy Markdown

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

Workspace numbers keep Light-mode colours after the bar turns Dark

1 participant