feat: add Settings toggle to show detailed remaining time#24
Open
carlosresu wants to merge 4 commits into
Open
feat: add Settings toggle to show detailed remaining time#24carlosresu wants to merge 4 commits into
carlosresu wants to merge 4 commits into
Conversation
Adds the localized label that the upcoming Settings toggle will use.
Adds a `detailed: bool` parameter to `format_line`, `format_countdown`, `format_countdown_from_secs`, `time_until_display_change`, and `time_until_display_change_from_secs`. When `true`, sub-units are surfaced (Xh Ym for hours, Xd Yh for days) and the display-change tick fires on minute/hour boundaries to match. All callers pass `false`, so behavior is unchanged. The toggle that flips this is added in a later commit.
Adds `TEXT_WIDTH_DETAILED` (95 px, the narrowest value that fits the worst-case `100% · 23h 59m` weekly display) alongside the existing 62 px default, plus a `text_width_for(detailed)` helper. Threads a `detailed: bool` parameter through `total_widget_width_for`, `model_usage_width`, `draw_usage_bar`, `draw_row`, and `paint_content` so the widget can size and clip text appropriately. All callers pass `false`, so behavior is unchanged. The toggle that flips this is added in a later commit.
Adds a new "Show detailed remaining time" entry under the right-click Settings submenu, off by default. When on, the 5h session window shows minutes alongside hours (e.g. "4h 12m") and the 7d weekly window shows hours alongside days (e.g. "3d 5h"). The widget grows to TEXT_WIDTH_DETAILED (95 px per row) while toggled, and the countdown timer repaints on the finer-unit boundary so the displayed value is never stale. The preference is persisted in settings.json as `show_detailed_remaining` and is loaded on startup. Existing settings.json files without the field deserialize to false.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in Show detailed remaining time checkbox under the right-click Settings submenu. When enabled:
4h 12minstead of4h)3d 5hinstead of3d)TEXT_WIDTH = 62toTEXT_WIDTH_DETAILED = 95per row — narrowest value that fits the worst-case100% · 23h 59mdisplayDefault is off, so existing installs see exactly today's behavior. The preference is persisted in
%APPDATA%\ClaudeCodeUsageMonitor\settings.jsonasshow_detailed_remainingand#[serde(default)]ensures older config files migrate cleanly.Localization added for English, Dutch, Spanish, French, German, Japanese, Korean, Traditional Chinese.
Sub-hour behavior unchanged
The toggle only adds a sub-unit when the top unit is
hord. Minutes and seconds displays render identically in both modes:Commits
The change is split into 4 atomic commits that each build cleanly:
Test plan