Repository navigation
fix(ui): decouple barRemaining from accent, add popover dismiss monitor, and fix codex issue override - #181
Conversation
…or, and fix codex issue override - Decouple Theme.barRemaining from user UI accentChoice (defaulting to healthy teal or green) so selecting magenta or orange does not turn every progress bar completely red. - Add NSPopoverDelegate and NSEvent global mouse monitor to AppDelegate so clicking outside on another app or desktop immediately dismisses the menu bar popover. - Clear issues["openai"] in MonitorModel whenever reconciled local windows contain valid quota data, preventing missing session files from suppressing live ChatGPT API readings. - Play audible alarm sound on any reset event when sound is audible, and allow reset alarms to fire on unanchored jumps to 100%.
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
Markdown rendering bug: GitHub-flavored markdown collapses the two literal ASCII spaces after the period in Kody rule violation: Use two spaces between sentences in every human-facing string and agent-written paragraph |
|
|
||
| // MARK: - Popover outside-click dismissal | ||
|
|
||
| private func startOutsideClickMonitor() { |
There was a problem hiding this comment.
Race condition in AppDelegate.swift: the Task { @MainActor in } wrapper defers the self.popover.isShown check, allowing a stale mouse-down to close a freshly-reopened popover when the popover closes and reopens between scheduling and execution, after which the queued Task reads popover.isShown == true and calls performClose on the new instance. Replace the Task wrapper with MainActor.assumeIsolated so the check and performClose execute synchronously with respect to the event.
outsideClickMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self] _ in
MainActor.assumeIsolated {
guard let self, self.popover.isShown else { return }
self.popover.performClose(nil)
}
}Prompt for LLM
File Sources/CodeCaps/AppDelegate.swift:
Line 368:
Race condition in `AppDelegate.swift`: the `Task { @MainActor in }` wrapper defers the `self.popover.isShown` check, allowing a stale mouse-down to close a freshly-reopened popover when the popover closes and reopens between scheduling and execution, after which the queued Task reads `popover.isShown == true` and calls `performClose` on the new instance. Replace the Task wrapper with `MainActor.assumeIsolated` so the check and `performClose` execute synchronously with respect to the event.
Suggested Code:
outsideClickMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self] _ in
MainActor.assumeIsolated {
guard let self, self.popover.isShown else { return }
self.popover.performClose(nil)
}
}
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
Summary
Theme.barRemainingno longer binds toTheme.accentwhen the user chooses a warm or danger-adjacent accent (such as magenta or orange), which previously turned entire quota bars completely red/pink. It now preserves healthy teal (or green).NSPopoverDelegateand registered anNSEventglobal mouse-down monitor on show (removed on close) so clicking anywhere outside the menu bar popover dismisses it immediately on the first click.MonitorModel.currentLocalResult()to clearissues["openai"]whenever reconciled local windows contain valid quota readings, preventing missing recent CLI session files from stamping "unavailable" over live ChatGPT API readings.ResetAlarmTrackerto recognize jumps to 100% even if the window initially lacked an anchored reset deadline.Verification
swift test: 365 tests passed, 0 failures across QuotaCoreTests and CodeCapsTests.