Skip to content

Commit 556f2bf

Browse files
committed
fix(menubar): force status bar redraw and lift subprocess QoS
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.
1 parent d69aa34 commit 556f2bf

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

mac/Sources/CodeBurnMenubar/CodeBurnApp.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
158158
attributes: [.font: font, .foregroundColor: color]
159159
))
160160
button.attributedTitle = composed
161+
// Force immediate redraw. NSStatusItem sometimes defers the status bar paint for an
162+
// accessory app that is not foreground, so the label visually freezes until the user
163+
// opens the popover (which triggers NSApp.activate + a forced redraw cycle).
164+
button.needsDisplay = true
165+
button.display()
161166
}
162167

163168
// MARK: - Popover

mac/Sources/CodeBurnMenubar/Security/CodeburnCLI.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ enum CodeburnCLI {
4141
// `env --` treats everything following as argv, not VAR=val pairs -- guards against an
4242
// argument accidentally resembling an env assignment.
4343
process.arguments = ["--"] + baseArgv() + subcommand
44+
// The menubar runs as an accessory app with no foreground window, and macOS
45+
// background-throttles accessory apps and their children. Without this lift the
46+
// codeburn subprocess parses 5-10x slower than the same command run from a
47+
// user-interactive terminal, which starves the 15s refresh cadence on large corpora.
48+
process.qualityOfService = .userInitiated
4449
return process
4550
}
4651

0 commit comments

Comments
 (0)