Skip to content

Port upstream 0.59.0: re-land stranded tray pace colors (#493) - #716

Draft
Finesssee wants to merge 3 commits into
mainfrom
port/micro-0.59.0-reland-tray-pace-colors
Draft

Finesssee wants to merge 3 commits into
mainfrom
port/micro-0.59.0-reland-tray-pace-colors

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

Re-lands the upstream v0.59 tray pace-color port #493. It was merged on 2026-09-13 only into the stacked base port/upstream-0.59.0 (merge 3f08d66c) and never reached main; git cherry against main @ 7695471b still reported both commits as missing.

  • Settings > Menu Bar: an opt-in menuBarColorPace toggle, "Color tray usage by pace" (off by default, persisted in settings.json).
  • Tray icon: when the toggle is on, the existing Windows bar or percent indicator is tinted green when the selected window is behind pace and red when it is ahead of pace (risk of running out early). On-track, unknown, missing and non-finite pace keep the normal usage color, and error icons stay desaturated.
  • The colors follow the canonical pace stages from commands/bridge/pace.rs::stage_str (slightly_behind/behind/far_behind and slightly_ahead/ahead/far_ahead), so the tray and the cards read the same stage.

Both original commits are cherry-picked with -x. main removed the PopOut surface in #712, so the PopOut test hunk was dropped instead of re-adding PopOutPanel.test.tsx, and the Display tab test keeps main's Overview layout and always-on-top tests next to the new pace-color test. A third commit adds the two new strings to the seven non-English locale files.

Upstream reference

  • Port v0.59 optional tray pace colors #493: upstream fe7a45ffab530e6b850800fd4a01ef1972709b0d (v0.59, optional pace colors in the menu bar icon).
  • Still upstream at v0.70.0 (tag-pinned GET): Sources/CodexBar/PreferencesMenuBarPane.swift keeps the menuBarColorPace toggle "Color Pace Indicator" ("Green pace indicator when behind pace, red when ahead of pace (risk of running out early)").

Ported / Deferred

Change Status
Persisted opt-in pace color setting, Settings toggle Ported
Tray bar and percent icons tinted by pace stage Ported
Canonical pace stage mapping shared with the cards Ported (second #493 commit)
Upstream menu bar layout pace tokens (session_pace, weekly_pace, auto_pace) and the icon-and-percent-only disable rule Not ported. Windows has no status-item text layout; the tray indicator is always an icon, so the toggle applies to both the bar and percent styles.

Locale: ColorPaceInTray and ColorPaceInTrayHelper are in rust/src/locale.rs, keys.ts and all eight .ftl files.

Validation

Run in the worker worktree on Rust 1.98.0 and Node 24 at 8c16d5d4:

Command Result
cargo +1.98.0 fmt --all --check pass
cargo +1.98.0 clippy --workspace --all-targets -- -D warnings pass
cargo +1.98.0 test -p codexbar 2162 passed, 0 failed, 1 ignored
cargo +1.98.0 test -p codexbar-desktop-tauri -- --skip bootstrap_payload_exposes_every_provider_variant 461 passed, 0 failed
pnpm install --frozen-lockfile pass
pnpm run check-locale 873 keys match between Rust and TS
pnpm test 65 files, 394 tests passed
pnpm run lint 0 errors. The 11 warnings are the same unused imports as on main
pnpm run build pass

The skipped desktop test is the non-hermetic #684 test, which reads the real %APPDATA%\CodexBar\settings.json on main. #711 fixes it separately.

New tests: tray_pace_color_is_opt_in_and_follows_canonical_stage (tray_bridge.rs), pace_color_maps_canonical_stage_and_tints_bars (rust/src/tray/render.rs), the settings round-trip in rust/src/settings/tests.rs, and "updates the tray pace color preference" in DisplayTab.test.tsx.

Affected areas

  • rust/src/tray/render.rs, rust/src/tray/mod.rs (TrayPaceColor, render_*_icon_rgba_with_pace)
  • rust/src/settings.rs, rust/src/settings/raw.rs, rust/src/settings/tests.rs (menu_bar_color_pace)
  • apps/desktop-tauri/src-tauri/src/tray_bridge.rs, commands/bridge.rs, commands/settings.rs
  • apps/desktop-tauri/src/surfaces/settings/tabs/DisplayTab.tsx and its test, types/bridge.ts, test fixtures
  • apps/desktop-tauri/src/i18n/keys.ts, rust/src/locale.rs, rust/src/locale/*.ftl

UI proof

Pending: a browser-use proof over WebView2 CDP of the Settings > Menu Bar toggle (off by default, persists after toggling), built from this head with isolated data. It will be posted as a "UI proof (browser-use)" comment. The tray icon pixels are native and are covered by the renderer and tray bridge unit tests above.

(cherry picked from commit d39adaf)
The re-landed tray pace color toggle added two keys to en-US only. Add them to the other seven locale files so every .ftl stays aligned with locale.rs and keys.ts.
@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Copy link
Copy Markdown
Collaborator Author

UI proof (browser-use)

Result: PASS on build 8c16d5d4aa5de5f7afbb04151cbd84592240cbe9, the current PR head "Translate tray pace color labels in every locale".

  • Settings > Menu Bar: the new "Color tray usage by pace" toggle sits right after "Show percent in tray", with its helper text. It starts off, turns the setting on and off through the backend, and stays on after a restart.
  • Tray icon pixels: not covered (native, browser-use per maintainer). The unit tests listed below cover them.

At the maintainer's direction, this proof drove the app's WebView2 over CDP with the browser-use CLI instead of CUA. It used no keyboard, mouse or focus. Clicks were DOM element.click() calls on the toggle, and the global shortcut was off in the kit settings.

Setup

  • Build: pnpm run tauri:build:debug in the worker worktree at 8c16d5d4. The exe was copied to the proof kit; its SHA-256 is 5cb2b560…ab659e7, and it loads index-D0jOehOm.js.
  • Proof-only patch: never committed, and reverted after the build.
    • A workspace Cargo.toml [patch.crates-io] dirs shim for an isolated home, plus the resulting Cargo.lock change.
    • A no-focus overlay, because this branch doesn't include Stop CodexBar from stealing focus #713 yet. It changes only window focus: it drops the tray panel set_focus call, builds the float bar with focused(false) and adds SWP_NOACTIVATE to the DWM frame refresh.
  • Home and providers: USERPROFILE, HOME, APPDATA, LOCALAPPDATA and XDG_CONFIG_HOME pointed at a home inside the kit. CODEX_HOME, CLAUDE_CONFIG_DIR and GEMINI_HOME pointed at empty kit folders, the provider API key variables were unset, and PATH was cut to the Windows system folders.
  • Settings: only Codex was enabled. The theme was auto, the float bar was off and the global shortcut was empty. menu_bar_color_pace was absent, so it took its default.
  • Data: CODEXBAR_SEED_USAGE_JSON supplied the Codex quota card: Session 40% used, Weekly 20% used, and a pace of stage behind (expected 52%, actual 40%, delta -12%).
  • Commands:
    • Run 1 and run 2 (restart): bash launch.sh settings:menuBar, which sets CODEXBAR_PROOF_MODE=settings:menuBar.
    • Both set WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9335 .... Checks ran as BU_CDP_URL=http://127.0.0.1:9335 BU_NAME=worker-716 BH_TAB_MARKER=0 browser-use.
    • Before each attach, curl /json/version showed Edg/154 WebView2, and the port 9335 listener was a WebView2 child of the kit exe.

Results

# Assertion Result
T0 No real email or account from the host is visible. The app page was scanned before each screenshot, and no scan found an @ address or the host user name. PASS
T1 Dark under theme auto in both runs: prefers-color-scheme: dark, data-theme=dark, body rgb(28, 28, 30) and text rgb(245, 245, 247). PASS
T2 Placement and copy. The Menu Bar fields, in order: Tray icon mode, Show provider icons, Prefer highest usage, Show percent in tray, Color tray usage by pace, Display mode, Pin to Taskbar (Windows 11). The new field's helper reads "Color the Windows tray usage indicator green when behind pace and red when ahead." Its control is input.toggle[type=checkbox] with aria-label="Color tray usage by pace". PASS
T3 Off by default. With the key absent from the settings file, the toggle is unchecked and enabled, and get_settings_snapshot (a read-only invoke) returns menuBarColorPace: false. PASS
T4 Each click reaches the backend. The sequence on, off, on gave a checked, unchecked, checked toggle. After each click, get_settings_snapshot returned true, false, true. The neighbouring settings stayed the same: menuBarShowsPercent: false, menuBarShowsHighestUsage: false, menuBarDisplayMode: "detailed", theme: "auto". PASS
T5 The tray has a pace to color by. get_cached_providers (read-only) returned the Codex snapshot with pace.stage: "behind", which maps to the green Behind tint. PASS
T6 Persists across a restart. After the kit exe was stopped and relaunched, the toggle was checked and get_settings_snapshot returned menuBarColorPace: true. The settings file stayed DPAPI-protected (codexbar.secure-file, windows-dpapi-user). PASS
T7 The proof never took focus. The app page reported document.hasFocus() as false at every step in both runs. PASS
— Tray icon tint Not covered (native, browser-use per maintainer). See the unit tests below.

Unit tests that cover the native tray path:

  • tray_bridge::tests::tray_pace_color_is_opt_in_and_follows_canonical_stage: the default settings ignore a pace; with the setting on, behind and ahead tint the icon and on_track doesn't.
  • tray::render::tests::pace_color_maps_canonical_stage_and_tints_bars: maps the slightly, plain and far stages, and checks the bar pixels are rgb(76, 175, 80) when behind and rgb(244, 67, 54) when ahead.
  • commands::settings tests: apply_display_settings_updates_tray_pace_color, plus the refreshes_tray_presentation assertion for menu_bar_color_pace, so toggling repaints the tray.
  • settings::tests::tray_pace_color_defaults_off_and_round_trips, and DisplayTab > updates the tray pace color preference.

Validation at 8c16d5d4

Run in the worker worktree on Rust 1.98.0 and Node 24:

Command Result
pnpm install --frozen-lockfile pass
pnpm run check-locale 873 keys match between Rust and TS
pnpm test 65 files, 394 tests passed
pnpm run lint 0 errors
pnpm run build pass
cargo +1.98.0 fmt --all --check pass
cargo +1.98.0 clippy --workspace --all-targets -- -D warnings pass
cargo +1.98.0 test -p codexbar 2162 passed, 0 failed, 1 ignored
cargo +1.98.0 test -p codexbar-desktop-tauri -- --skip bootstrap_payload_exposes_every_provider_variant 461 passed, 0 failed. The skipped test is the non-hermetic #684 test that #711 fixes.
ci/circleci: pr-check success

Screenshots

All paths are under C:\Users\FSOS\AppData\Local\Win-CodexBar\port-audit\proof\716\shots\.

File What it shows
716-menubar-pace-off.png Settings > Menu Bar, dark: the new toggle, unchecked by default, after "Show percent in tray".
716-menubar-pace-on.png The same tab after the on, off, on clicks: the toggle is checked.
716-menubar-pace-after-relaunch.png After a restart of the kit exe: the toggle is still checked.

Not blocking

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