Skip to content

Add Color by provider tray icon style - #895

Merged
Finesssee merged 5 commits into
mainfrom
feat/color-by-provider
Oct 16, 2026
Merged

Finesssee merged 5 commits into
mainfrom
feat/color-by-provider

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Ports upstream "Color by provider" (steipete#4321; upstream commits 2f232d6, fd7fab6, cad61e8, bb64180).

  • New Color by provider toggle in Settings → Menu Bar (menu_bar_color_by_provider, default off, also allowed in the portable preferences document).
  • When it's on, tray meters use the shown provider's accent color: bar meters, percent glyphs, and each row of the Stacked icon (each row gets its own provider's color). The accent comes from effective_accent_color, so per-provider accent overrides apply.
  • Following upstream's rule that provider color is decoration only:
    • stale/error icons keep the desaturated look;
    • accents with less than 2:1 contrast against the tray canvas fall back to the usage-level colors.
  • The renderer gains *_tinted variants. The existing functions call them with no tint, so default output is unchanged.

Differences from upstream:

  • Contrast reference: contrast is checked against the fixed Windows tray canvas (60,60,70) instead of upstream's gray reference.
  • Pace precedence: when pace coloring is on, pace color takes precedence over the provider tint.
  • Accessibility: upstream also skips the tint in high-contrast/accessibility appearances. The Windows tray has no high-contrast detection yet, so that gate is not applied.
  • Scope: tray only. Upstream's other tinted surfaces (layout editor, menu card) have no Windows equivalent.

Commands run

  • cargo fmt --all: clean
  • cargo test --manifest-path rust/Cargo.toml: 4734 passed, 1 ignored. Two unrelated tests failed only under full-suite load and passed when run alone (dashboard::coordinator timeout, grok::accounts::orca file replace).
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml: 741 passed
  • cargo clippy -D warnings on both manifests: clean
  • pnpm test: 135 files, 1272 tests passed; pnpm run build: ok (includes locale key check)

UI proof

Result: pass, with one gap (tray icon pixels not captured).

  • Branch feat/color-by-provider at 567f4fa
  • Binary: C:\Users\FSOS\AppData\Local\Win-CodexBar\cargo-target\repo-bb654619ec0c47e2\worktree-8e72f6650188b478\debug\codexbar-desktop-tauri.exe (built after HEAD)
  • Proof mode settings:menuBar; CDP port 9371
  • Method: fresh pnpm run tauri:build:debug; launched with CODEXBAR_PROOF_MODE and WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port. CDP drives the Settings page target (trusted Input.dispatchMouseEvent; native <select> set through the React value setter + change) and reads persisted values with get_settings_snapshot. cua-driver 0.34.0 gives verify_state, real-pixel get_window_state screenshots and DWM facts. Background only: windows parked on the secondary monitor, no foreground or keyboard use. Settings were backed up and byte-restored afterwards.

CDP assertions (all passed; log W:/mac-parity/proof/895/steps.jsonl):

  • The Menu Bar tab shows a Color by provider field, and the toggle DOM matches menuBarColorByProvider (false at start).
  • Click: the toggle flips to true, and get_settings_snapshot().menuBarColorByProvider is true.
  • Click again: the toggle and the persisted value return to false.
  • Focus never moved to CodexBar.

CUA (W:/mac-parity/proof/895/):

  • verify_state window exists; DWM dark = true under theme auto.
  • 01-menubar-before.png, 02-menubar-toggled.png, 03-menubar-restored.png

Not covered:

  • Tray icon pixels. The tray button was located through UIA (SystemTray.NormalButton), but the captured rectangle showed no rendered icon. So the coloured tray icon itself is not proven. Unit tests cover the renderer only.

Personal info visible: none in the screenshots. The tray tooltip read during the UIA attempt contains provider status text only.

Factory Agent added 5 commits October 16, 2026 09:32
Add tinted variants of the bar, stacked, and percent renderers that take an optional provider accent. Pace colors win over the accent, error icons ignore it, and an accent below a 2:1 contrast floor against the tray canvas falls back to the usage-level colors. Existing renderers delegate with no tint, so default output is unchanged.
Store the opt-in Color by provider flag (default off) in settings and the raw serde mirror, and allow it in the portable preferences document so exports and imports carry it.
Add the opt-in tint to the tray plan: a single meter or percent glyph takes the shown provider's effective accent, and each stacked row takes its own provider's accent. The accent is parsed from #RRGGBB and malformed values yield no tint. Expose menu_bar_color_by_provider through the settings patch and the bridge DTO, with tests for default-off parity, accent overrides, and stacked rows.
Add the Color by provider switch below the pace toggle, wired to menuBarColorByProvider in the bridge types, with test fixtures and tests for the set call and the stacked-mode state. Add its label and helper strings to all ten locales, with keys in the Rust and TypeScript lists.
Add one Windows Unreleased line for the tray color-by-provider option, citing upstream steipete#4321.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ff9d4b6d-d76e-4dcd-ad11-df39382833ff
📥 Commits

Reviewing files that changed from the base of the PR and between 930593a and 567f4fa.

📒 Files selected for processing: 34
  • CHANGELOG.md
  • apps/desktop-tauri/src-tauri/src/commands/bridge.rs
  • apps/desktop-tauri/src-tauri/src/commands/settings.rs
  • apps/desktop-tauri/src-tauri/src/tray_presentation.rs
  • apps/desktop-tauri/src-tauri/src/tray_presentation_tests.rs
  • apps/desktop-tauri/src/App.test.tsx
  • apps/desktop-tauri/src/floatbar/FloatBar.test.tsx
  • apps/desktop-tauri/src/i18n/keys.ts
  • apps/desktop-tauri/src/surfaces/TrayPanel.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/AboutTab.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/AdvancedTab.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/MenuBarTab.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/MenuBarTab.tsx
  • apps/desktop-tauri/src/types/bridge.test.ts
  • apps/desktop-tauri/src/types/bridge.ts
  • rust/src/locale.rs
  • rust/src/locale/en-US.ftl
  • rust/src/locale/es-MX.ftl
  • rust/src/locale/ja-JP.ftl
  • rust/src/locale/ko-KR.ftl
  • rust/src/locale/pt-BR.ftl
  • rust/src/locale/ru-RU.ftl
  • rust/src/locale/tr-TR.ftl
  • rust/src/locale/uk-UA.ftl
  • rust/src/locale/zh-CN.ftl
  • rust/src/locale/zh-TW.ftl
  • rust/src/settings.rs
  • rust/src/settings/preferences_document.rs
  • rust/src/settings/preferences_document/tests.rs
  • rust/src/settings/raw.rs
  • rust/src/settings/tests.rs
  • rust/src/tray/mod.rs
  • rust/src/tray/render.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Adds a default-off setting to color Windows tray usage indicators by provider. The setting is persisted, exposed in Menu Bar settings, and applied to bars, percentage text, and stacked meters, with existing pace colors and fallback behavior retained.

Changes: Provider-Based Tray Coloring

Layer / File(s) Summary
Add and expose the provider-color setting
rust/src/settings/*, rust/src/settings/preferences_document*, apps/desktop-tauri/src-tauri/src/commands/{bridge,settings}.rs, apps/desktop-tauri/src/types/bridge.ts, apps/desktop-tauri/src/surfaces/settings/tabs/MenuBarTab.tsx, apps/desktop-tauri/src/i18n/keys.ts, rust/src/locale/*, apps/desktop-tauri/src/**/*test*, CHANGELOG.md
Adds the default-off preference to settings storage and the bridge. Adds the Menu Bar toggle and localized label and helper text. Updates related settings fixtures and tests.
Render provider tints with fallback rules
rust/src/tray/{mod,render}.rs
Adds tinted renderer variants for bars, percentage text, and stacked meters. Pace colors take precedence, and error icons or low-contrast tints use existing colors.
Select provider tints for tray icon plans
apps/desktop-tauri/src-tauri/src/tray_presentation.rs, apps/desktop-tauri/src-tauri/src/tray_presentation_tests.rs
Tray presentation resolves each selected provider’s tint and passes it to the renderer. Tests cover disabled coloring, provider brand colors, accent overrides, malformed accents, and stacked meters.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant MenuBarTab
  participant SettingsUpdate
  participant SettingsSnapshot
  participant tray_presentation
  participant render_icon
  participant render_bar_icon_rgba_tinted
  User->>MenuBarTab: Enables provider coloring
  MenuBarTab->>SettingsUpdate: Sends menuBarColorByProvider
  SettingsUpdate->>SettingsSnapshot: Updates and exposes setting
  SettingsSnapshot->>tray_presentation: Supplies setting and provider data
  tray_presentation->>render_icon: Provides icon plan with provider tint
  render_icon->>render_bar_icon_rgba_tinted: Renders tinted usage indicator
Loading

Suggested reviewers: pasharm

Merge Risk: ⚪ Minimal · up to 567f4

No actionable issue remains with the provider-color tray setting after normal checks.

Pre-merge checks: Passed 7 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Ui Changes Include Windows Proof Warning The PR changes visible behavior. The diff adds a “Color by provider” toggle in MenuBarTab.tsx and provider-tinted tray rendering in rust/src/tray/render.rs. The description says “UI proof is pendi… Add screenshots or a completed proof note from a fresh Windows build to the PR description. Replace the pending UI-proof statement with the actual verification details.
Passed Passed checks: 7 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Provider Data Stays Siloed Passed The change keeps provider data siloed. provider_tint derives the tint from the same ProviderUsageSnapshot.provider_id and looks up that provider's effective accent. Stacked icons pass each selecte…
Secrets Handled Safely Passed No changed code or files introduce, log, display, snapshot, or persist a token, cookie, API key, OAuth credential, or authorization header. The new data path handles only a boolean setting, provider I…
No Unapproved Dependencies Passed The pull-request diff changes no Cargo.toml, package.json, npm/yarn lockfile, or pnpm packageManager declaration. It adds no dependency and does not change the pinned pnpm version.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title is a short imperative summary that directly describes the addition of the Color by provider tray icon setting.
Full details: Ui Changes Include Windows Proof

Explanation

The PR changes visible behavior. The diff adds a “Color by provider” toggle in MenuBarTab.tsx and provider-tinted tray rendering in rust/src/tray/render.rs. The description says “UI proof is pending” and that it “will be captured before merge”; it includes no screenshot or completed proof note from a fresh Windows build.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee
Finesssee merged commit 915b4ba into main Oct 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant