Skip to content

fix(menubar): force status bar redraw and lift subprocess QoS#125

Merged
iamtoruk merged 1 commit intomainfrom
fix/menubar-force-redraw
Apr 21, 2026
Merged

fix(menubar): force status bar redraw and lift subprocess QoS#125
iamtoruk merged 1 commit intomainfrom
fix/menubar-force-redraw

Conversation

@iamtoruk
Copy link
Copy Markdown
Member

After 0.8.5's prefetchAll removal the menubar still looked stuck: the label would freeze for a minute or more at a time, and only refreshed at the moment the user clicked the icon to open the popover. Two causes, both fixed here.

  1. The status bar does not always paint `attributedTitle` changes immediately for an accessory app that is not foreground. Adding `needsDisplay = true` and `display()` after each update forces the paint every cycle. Opening the popover used to be the only thing that triggered a redraw because `NSApp.activate` ran as a side effect of the click handler.

  2. The `codeburn` subprocess inherited the accessory app's default QualityOfService. macOS background-throttles accessory apps and their children. On measurement a user-interactive terminal runs the same command in 0.75 seconds, and the throttled version can be 5-10x slower, which overruns the 15s poll cadence. Setting `process.qualityOfService = .userInitiated` in `CodeburnCLI.makeProcess` keeps the subprocess at terminal speed.

Local `swift build` clean.

Two independent causes for the stuck-label / only-refreshes-on-click
behaviour, both fixed here.

1. NSStatusItem button defers the status bar paint for accessory apps
   that are not foreground, so after refreshStatusButton sets the new
   attributed title the menu bar visually froze until the user opened
   the popover (which triggers NSApp.activate and a forced redraw
   cycle). Explicit needsDisplay + display() forces the paint every
   cycle.

2. The codeburn subprocess inherited the accessory app's default QoS,
   which macOS background-throttles. That could stretch a sub-1-second
   parse into tens of seconds on large corpora and overrun the 15s
   refresh cadence. Set .userInitiated so the CLI runs at the same
   priority it does from a user-interactive terminal.
@iamtoruk iamtoruk merged commit 90aa342 into main Apr 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant