Skip to content

feat: add an estimated time to depletion (ETD) indicator#38

Open
carlosresu wants to merge 1 commit into
CodeZeno:mainfrom
carlosresu:feat/etd
Open

feat: add an estimated time to depletion (ETD) indicator#38
carlosresu wants to merge 1 commit into
CodeZeno:mainfrom
carlosresu:feat/etd

Conversation

@carlosresu

@carlosresu carlosresu commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Adds an opt-in Estimated Time to Depletion (ETD) indicator that tells you how long until a quota runs out at your current pace, so you can see at a glance whether you're about to hit the limit before the window resets. Rebased on v1.4.8 and extended to the Antigravity model. Inspired by issue #21.

When a usage bar is on pace to deplete before its window resets, the cell appends the estimate after the remaining time:

  • The remaining countdown gains a rem label and the estimate follows as … ETD, e.g. 90% · 1d rem · 13h ETD — about a day until the weekly window resets, but at the current burn rate you'd run out in ~13h.
  • Derived from each section's resets_at and the fixed window length (5h / 7d): etd = (100 − used%) / (used% / elapsed). Shown only when the projected depletion lands before the reset — i.e. exactly when you're over pace. Cells pacing safely show nothing extra.
  • Applies to all cells of all three models: Claude, Codex, and Antigravity × session/weekly.

Off by default; persisted to settings.json via #[serde(default)] show_etd, so existing settings migrate cleanly.

Dynamic column width

The usage-cell text column measures the actual rendered text (GetTextExtentPoint32W in the widget's own font) and sizes to it, so the ETD suffix is never clipped and no empty space is reserved when ETD isn't showing. The widget grows only when content needs it and shrinks back when the suffix clears.

Screenshots

Show ETD enabled — a cell over pace shows the estimate; cells pacing safely stay bare.

ETD

Settings control

A single right-click Settings → Show ETD checkbox toggles it; the checkmark reflects state, toggling repaints live and persists immediately.

Localization

Show ETD, the ETD label, and the rem label are present in all 10 supported locales (a missing field is a compile error).

Independence & compatibility

Branches directly off v1.4.8 main (single commit) and contains only the ETD feature — merge it alone, or alongside the detailed-remaining-time (#24) and pace-indicator (#25) PRs in any order: every combination merges with 0 conflicts (verified via git merge-tree + a triple-merge that builds and passes tests).

Tests

7 ETD unit tests in poller.rs: etd_secs safe/at-risk/boundary cases, a ~3,000-case property sweep of the at-risk invariant (used% > 100·elapsed/window), and etd_suffix present/absent/no-reset cases. cargo test green (12 total with v1.4.8's own poller tests).

Test plan

  • cargo build + cargo test clean on v1.4.8
  • Right-click → Settings → Show ETD (off by default)
  • Over-pace cell gains · <rem> rem · <etd> ETD; safe cell stays bare; Antigravity cell behaves like Claude/Codex
  • Column sizes to content — no clipping, no reserved gap; setting persists across restart

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