coding-usage-bar 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/menubar.d.ts CHANGED
@@ -5,6 +5,7 @@ export type TitleMode = "auto" | TitleTier;
5
5
  export declare function readTitleMode(paths?: RuntimePaths): TitleMode;
6
6
  export declare function writeTitleMode(mode: TitleMode, paths?: RuntimePaths): TitleMode;
7
7
  export declare function cycleTitleMode(paths?: RuntimePaths): TitleMode;
8
+ export declare function resolveTitleTier(mode: TitleMode, display: StatusSnapshot["display"], providerCount: number): TitleTier;
8
9
  export declare function pickTitleTier(display: StatusSnapshot["display"], providerCount: number): TitleTier;
9
10
  export declare function swiftBarPluginPath(paths?: RuntimePaths): {
10
11
  dir: string;
package/dist/menubar.js CHANGED
@@ -171,6 +171,20 @@ export function cycleTitleMode(paths = buildPaths()) {
171
171
  const next = TITLE_MODE_CYCLE[(TITLE_MODE_CYCLE.indexOf(current) + 1) % TITLE_MODE_CYCLE.length];
172
172
  return writeTitleMode(next, paths);
173
173
  }
174
+ const TITLE_TIER_WIDTH_RANK = { icon: 0, single: 1, full: 2 };
175
+ // A manual mode may narrow the title but never widen it past a measured budget:
176
+ // an overflowing item is pushed under the notch, and the Title row that would
177
+ // undo the choice lives in that item's own dropdown, so the user is locked out.
178
+ // With no measurement the manual choice stands, since autoTier is only a guess.
179
+ export function resolveTitleTier(mode, display, providerCount) {
180
+ const autoTier = pickTitleTier(display, providerCount);
181
+ if (mode === "auto") {
182
+ return autoTier;
183
+ }
184
+ const budget = display?.extrasBudgetPt;
185
+ const measured = typeof budget === "number" && Number.isFinite(budget);
186
+ return measured && TITLE_TIER_WIDTH_RANK[mode] > TITLE_TIER_WIDTH_RANK[autoTier] ? autoTier : mode;
187
+ }
174
188
  export function pickTitleTier(display, providerCount) {
175
189
  if (providerCount === 0) {
176
190
  return "icon";
@@ -662,10 +676,13 @@ function titleLine(tier, providers, title, topState, prefersDark) {
662
676
  ? line(text, { ...titleIconParams(), dropdown: false })
663
677
  : iconLine();
664
678
  }
665
- function titleModeLabel(mode, autoTier) {
666
- return mode === "auto"
667
- ? `Title Auto (${TITLE_TIER_LABEL[autoTier]})`
668
- : `Title ${TITLE_TIER_LABEL[mode]}`;
679
+ function titleModeLabel(mode, autoTier, tier) {
680
+ if (mode === "auto") {
681
+ return `Title Auto (${TITLE_TIER_LABEL[autoTier]})`;
682
+ }
683
+ return mode === tier
684
+ ? `Title ${TITLE_TIER_LABEL[mode]}`
685
+ : `Title ${TITLE_TIER_LABEL[mode]} (no room, ${TITLE_TIER_LABEL[tier]})`;
669
686
  }
670
687
  // Carries the "why" behind a degraded title without spending a menu row on it.
671
688
  function titleModeTooltip(display, autoTier) {
@@ -839,8 +856,8 @@ export function renderMenuBar(snapshot = loadDisplayStatusSnapshot(), paths = bu
839
856
  const providers = titleProviders(snapshot);
840
857
  const title = providers.map(titleSegment).join(` ${TITLE_SEPARATOR} `);
841
858
  const autoTier = pickTitleTier(snapshot.display, providers.length);
842
- const tier = mode === "auto" ? autoTier : mode;
843
- const modeLine = line(titleModeLabel(mode, autoTier), {
859
+ const tier = resolveTitleTier(mode, snapshot.display, providers.length);
860
+ const modeLine = line(titleModeLabel(mode, autoTier, tier), {
844
861
  bash: stableNodeExecutable(),
845
862
  param1: appCliPath(paths),
846
863
  param2: "menubar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-usage-bar",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "macOS menu bar usage monitor for Claude Code, Codex, GLM, DeepSeek, and MiniMax.",
5
5
  "author": "hanzhangzzz",
6
6
  "license": "MIT",