Repository navigation
Description
What happens
Switching AeroSpace workspaces makes the workspace widget's animation look laggy: the highlight jumps instead of sliding. Each switch blocks the bar's main thread for about 200 ms, then for another 80–110 ms, while the widget's animation lasts 0.25 s.
Steps to reproduce
- Use a bar with a Workspaces widget from AeroSpace (here
showEmpty,windowsand an underline below the bar) and a dozen other widgets, on two displays. - Switch workspaces:
aerospace workspace 2, thenaerospace workspace 3, a few times. - Watch the focused workspace's highlight, or record with Instruments' Animation Hitches template attached to StableBar.
Expected
The highlight slides smoothly. A switch updates the Workspaces widget, not every widget on every display.
Environment
- StableBar 0.16.0-beta.20261114170809.1078
- macOS 27.2.1, built-in display and an external 2560-point display
- AeroSpace 0.21.3-Beta, 4 windows
- 14 widgets, including Workspaces, App menus, Menu bar items, System, Now Playing and two clocks
Evidence
- Animation Hitches, 8 switches 1.2 s apart: one hitch per switch of 175–233 ms, followed by one of 83–108 ms. The main thread ran at 100 % on a performance core throughout each hitch.
- The time profile of those hitches: 81 % in SwiftUI's observation-driven graph updates (
NSHostingView.beginTransaction→GraphHost.flushTransactions), withBarView.bodyand everyWidgetView.bodyrunning again. - The AeroSpace queries behind a refresh take about 20 ms each, so the delay is in the bar, not in AeroSpace.
- A test with
withObservationTrackingaroundstore.barEditing.widgets(on:): changing the focused workspace invalidates it, and so does changing a window's title, while the widget list it returns stays the same.
Diagnosis
BarView.body gets its widgets from store.barEditing.widgets(on:), which calls visibility(of:on:) (Sources/StableBar/BarEditing.swift, lines 117–131 on main). That reads store.workspaceStore.workspaces twice: to find the focused workspace's monitor for display rules, and to hide a Workspaces widget with nothing to show on that display. Observation tracks the whole array, so every refresh that changes it invalidates BarView.body on every display: a workspace switch, a focus change, a window opening or closing, or a window title changing, since titles are part of the list. BarView then rebuilds every unit, the hidden copy that measures widths and the narrowest copy for App menus, so every widget's body runs again.
WorkspaceView already reads the workspaces it shows by itself, so only the visibility check needs to stop depending on the whole list.
Related
- Consume AeroSpace workspace trees without follow-up snapshot queries #387 (not planned) is about the latency of AeroSpace's follow-up queries, not about what the bar redraws.
- docs/performance.md measured about 45 ms of CPU time per switch for the presentation example on one display.
- A closed Settings window that keeps redrawing makes these hitches worse; filed separately.
Triaged by Claude Code (Claude Opus 5.5).
Activity
chore(release): 0.16.0 [skip ci]
stablebar-releases commentedon Nov 16, 2026
🎉 This issue has been resolved in version 0.16.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀