Skip to content

Commit d37f9c0

Browse files
authored
fix: preserve menu bar text when pace is unavailable (#1474)
Fall back to the selected quota percentage when Pace mode cannot compute pace, preventing the status item from collapsing to icon-only near resets or with incomplete window metadata. Fixes #1462.
1 parent 2c7283b commit d37f9c0

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 0.34.1 — Unreleased
44

5+
- Menu bar: keep the selected quota percentage visible in Pace mode when pace is temporarily unavailable instead of collapsing to an icon-only status item (fixes #1462).
56
- Menu bar: restore native macOS positioning for merged provider dropdowns while preparing current content before AppKit lays out the menu.
67
- Menu bar: keep cached provider content visible while switching merged tabs so the open menu no longer flickers through an empty state.
78
- Menu bar: handle the global open-menu shortcut synchronously so repeated presses close the tracked menu instead of queueing a delayed reopen (#1470). Thanks @Zihao-Qi!

Sources/CodexBar/MenuBarDisplayText.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ enum MenuBarDisplayText {
2828
case .percent:
2929
return self.percentText(window: percentWindow, showUsed: showUsed)
3030
case .pace:
31+
// Pace can be temporarily unavailable near a reset or when a provider omits window metadata.
32+
// Keep the selected quota visible instead of collapsing the status item to an icon-only state.
3133
return self.paceText(pace: pace)
34+
?? self.percentText(window: percentWindow, showUsed: showUsed)
3235
case .both:
3336
guard let percent = percentText(window: percentWindow, showUsed: showUsed) else { return nil }
3437
// Fall back to percent-only when pace is unavailable (e.g. Copilot)

Tests/CodexBarTests/StatusItemAnimationTests.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,7 @@ struct StatusItemAnimationTests {
907907
percentWindow: percentWindow,
908908
showUsed: true)
909909

910-
#expect(pace == nil)
911-
// "Both" mode falls back to percent-only when pace is unavailable
910+
#expect(pace == "40%")
912911
#expect(both == "40%")
913912
}
914913

@@ -927,8 +926,7 @@ struct StatusItemAnimationTests {
927926
pace: nil,
928927
showUsed: true)
929928

930-
#expect(pace == nil)
931-
// "Both" mode falls back to percent-only when pace is unavailable
929+
#expect(pace == "40%")
932930
#expect(both == "40%")
933931
}
934932

0 commit comments

Comments
 (0)