Skip to content

Each workspace switch freezes the bar for about 200 ms, so the switch animation jumps #670

Closed

Description

@M4n0x

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

  1. Use a bar with a Workspaces widget from AeroSpace (here showEmpty, windows and an underline below the bar) and a dozen other widgets, on two displays.
  2. Switch workspaces: aerospace workspace 2, then aerospace workspace 3, a few times.
  3. 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), with BarView.body and every WidgetView.body running 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 withObservationTracking around store.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

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Nov 15, 2026
  2. stablebar-releases commented on Nov 16, 2026

    @stablebar-releases

    🎉 This issue has been resolved 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions