Menu bar: optional color-coded usage icon (off by default) - #2557
Menu bar: optional color-coded usage icon (off by default)#2557johnlarkin1 wants to merge 6 commits into
Conversation
New `menuBarUsageColorsEnabled` setting, absent-means-false, tints the meter icon from green through amber to red as usage rises. A template image keeps only its alpha mask and is recolored by AppKit, which is why tinting one through `contentTintColor` has no effect on macOS 26. When a tint is active the geometry is drawn in that color and the bitmap is marked non-template, matching what `quotaWarningFlashImage` already does. The palette is fixed sRGB rather than the dynamic system colors, so nothing appearance-dependent is baked in and the render stays a pure function of its inputs. Icon + Percent renders the provider brand logo through MenuBarLayoutRenderer and is left untouched; the toggle is disabled in that style. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…t no-op Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`tint shifts from green toward red as usage rises` required red to be non-decreasing at every step, but the ramp's anchors are green (0.14) → orange (0.85) → red (0.80): red dips 0.05 on the orange → red leg. The test has never run — MenuBarUsageTintTests.swift has not compiled since it was added in e3f9c2d, so the assumption was never checked against the palette. #26 fixed the compile error and CI aborted at group 44/95 before reaching this suite, so it stayed hidden. Keeping the per-step green assertion (green is the channel that carries "toward red" across both segments) and the end-to-end red assertion, and scoping the per-step red assertion to the green → orange leg. The palette is deliberate and documented for legibility on light, dark, and translucent menu bars, so the over-specified test is what gives. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 3:46 PM ET / 19:46 UTC. ClawSweeper reviewWhat this changesAdds an off-by-default Settings toggle that tints meter-style menu-bar usage icons from green through amber to red as the provider’s primary usage rises. Merge readiness⛔ Blocked until real behavior proof is added - 5 items remain Keep this PR open for maintainer review. It is a focused, off-by-default feature rather than an existing-behavior fix; the supplied patch appears to preserve current users’ default rendering, but the added persistent visual mode needs product sponsorship and real native-app proof before merge. Priority: P3 Review scores
Verification
How this fits togetherCodexBar turns provider usage snapshots into either a meter icon or a provider-brand menu-bar layout. The status-item controller resolves usage and preferences, then sends the selected rendering inputs to the AppKit icon renderer and status-bar button. flowchart LR
A[Provider usage snapshot] --> B[Usage percent resolver]
C[Menu bar preferences] --> D[Status item controller]
B --> D
D --> E{Brand icon layout enabled?}
E -->|No| F[Meter icon renderer]
E -->|Yes| G[Provider brand layout]
F --> H[Status bar image]
G --> H
Decision needed
Why: The proposed implementation is deliberately narrow, but deciding whether this additional user preference and its acknowledged visual trade-off fit the menu-bar product direction requires maintainer intent rather than a mechanical code repair. Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: If maintainers want this optional visual signal, keep the absent-means-false preference and meter-only boundary, then merge after redacted proof from a freshly built bundle demonstrates off/on behavior at representative usage levels and the highlighted status-item state. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes a new optional visual mode instead of reporting broken existing behavior. Current source clearly identifies the meter and brand-layout paths that require manual verification. Is this the best way to solve the issue? Unclear: constraining the tint to the meter path and preserving the default is a narrow technical approach, but accepting the new preference and its non-template highlight behavior is a product decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 78523f4ad890. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
hey sorry - these are not ready and I will reopen when polished and I've done a review with solid evidence |
Tints the meter icon green → amber → red as usage rises. One toggle in Settings ▸ Menu Bar ▸ Icon, off by default.
This is a narrower, rebuilt version of the idea in #1207, split down to icon rendering only.
Addressing the #1207 review
menuBarUsageColorsEnabled, absent-means-false. No migration, noregisterDefaults. Existing installs render byte-identical icons.contentTintColoranywhere. A template image keeps only its alpha mask and is recoloured by AppKit — which is exactly why tinting one does nothing on macOS 26. When tinted, the geometry is drawn in the colour and the bitmap marked non-template, the same approach as the existingquotaWarningFlashImage.resolvedMenuBarIconPercents, which is provider-aware today. Noweekly, nosecondaryin this diff.check-app-locales.mjsclean.Why there is no appearance observer
The palette is fixed sRGB, not
NSColor.system*. SincebaseFillbecomes the tint outright, no dynamic colour is ever resolved into the bitmap — not the track fill, not the stroke, not the status overlay (hence threadingcolor:intodrawStatusOverlay). The render is a pure function of its inputs, so there is no stale-bitmap-on-appearance-flip bug to fix, no KVO observer, and the cache key is honest. A test pins that invariant.Works identically on macOS 14–26. No
#availablegates.Scope boundaries
MenuBarLayoutRenderer.attachmentImage, which exists to fix v0.45.0 custom menu-bar layout renders provider icons as tiny white dots on a light menu bar #2325. The toggle is disabled in that style. Brand-logo tinting would be a separate change.Known trade-off
A non-template image does not invert under the status-item highlight — same as
quotaWarningFlashImagetoday. Fine against macOS 26's translucent capsule, less crisp on 15's solid fill. Off by default, one toggle to revert.Verification
swift buildandnode Scripts/check-app-locales.mjsclean against this branch on currentmain. Tests cover the tint ramp, the non-dynamic-colour invariant, and the off-by-default no-op.The ramp's anchors are green
0.14→ orange0.85→ red0.80, so red dips slightly on the orange → red leg; the test asserts monotonic green end-to-end and monotonic red only on the green → orange leg. Palette values were picked for legibility against light, dark, and translucent menu bars rather than to form a monotonic ramp — say the word if you'd rather they were tuned differently.