fix(menubar): force status bar redraw and lift subprocess QoS#125
Merged
fix(menubar): force status bar redraw and lift subprocess QoS#125
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.
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.