Repository navigation
Conversation
Every Touch Bar refresh, and every widget configured when the bar is rebuilt on app activation, built a snapshot on the main thread that: - queried the home volume's capacity with URL.resourceValues, although SystemMonitor already samples the same figure off the main thread as diskStats.usagePercent (used = total - available for important usage); - asked CoreWLAN for the current SSID, a value no widget reads. The Wi-Fi status widget has its own CWWiFiClient and is unaffected. The snapshot now uses diskStats.usagePercent and the unused wifiName field is removed.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Code Review ✅ Approved🟡 Medium risk · Using cached disk usage may make the Touch Bar’s SSD value stale; the excluded GroupViews.swift deletion has unclear impact. Moves the Touch Bar snapshot's SSD usage to the cached VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Approved For more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Why
CoreMonTouchBarController.makeSnapshot()runs on the main thread:configure(_:)whenever the bar is rebuilt.startAppTouchBar()runs when Core-Monitor becomes active and again shortly after any other app is activated, so app switching triggers it too.Each snapshot made two system calls on the main thread:
storageUsagePercent()calledURL.resourceValuesfor the home volume's capacity.SystemMonitoralready samples the same figure off the main thread asdiskStats.usagePercent, using the same formula: used = total − available for important usage.currentWiFiName()calledCWWiFiClient.shared().interface()?.ssid(). Nothing readsTouchBarSystemSnapshot.wifiName.Change
ssdPctnow comes fromsystemMonitor.diskStats.usagePercent.wifiNamefield,currentWiFiName(),storageUsagePercent()and the controller'simport CoreWLANare removed.SWifiItem) has its ownCWWiFiClientand is unchanged.The SSD bar now follows
SystemMonitor's disk cache rather than reading the volume live. Because it refreshes every 10 s anyway, the value should look the same.Verified
xcodebuild test -scheme Core-Monitor -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NOpasses locally on Xcode 27.0: TEST SUCCEEDED, 0 failures.Not done: I did not check this on Touch Bar hardware.