Add optional remaining-time countdown to menu bar title#5
Open
DaniSchenk wants to merge 1 commit into
Open
Conversation
Adds a "Show remaining time in window" toggle (persisted in config) that appends a compact reset countdown to each window's percentage in the menu bar title, e.g. "5h 37% (1h12m) · 7d 10% (3d4h)". Off by default. The countdown is time-driven, not data-driven: polls are 15-30 min apart, so a dedicated once-a-minute MinuteTick event (mirroring the existing blink ticker pattern) repaints the title so the countdown rolls. The handler short-circuits unless the feature is on and the alarm isn't blinking, and the native set_title already fingerprints segments to skip redundant AppKit work, so an unchanged repaint is effectively free. short_countdown renders finer than the menu's reset_suffix (minute precision above 2h, 2-unit max) and returns None past the deadline so a stale percentage never sits next to a countdown implying it's still blocked. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds a "Show remaining time in window" menu toggle (persisted in config, off by default) that appends a compact reset countdown to each window's percentage in the menu bar title:
Why
The percentages alone don't tell you when a window frees up. This surfaces the reset countdown inline for anyone pacing work against the 5h / 7d limits, without cluttering the bar for people who don't want it.
How it works
show_remaining_timefield (defaults tofalse), toggled from the tray menu and saved toconfig.json.short_countdownrenders finer than the menu's existingreset_suffix— minute precision above 2h, 2-unit max (3d4h,1h12m,45m). It returnsNonepast the deadline so a stale percentage never sits next to a countdown implying the window is still blocked.MinuteTickevent (mirroring the existingBlinkTickticker pattern) repaints the title. The handler short-circuits unless the feature is on and the alarm isn't blinking. Cost is negligible: the nativeset_titlealready fingerprints segments and skips the AppKit call when nothing changed, so an unchanged repaint just rebuilds a smallVeconce a minute.Notes for reviewers
src/bin/menubar.rs); no new dependencies.short_countdown_buckets): day/hour/minute boundaries, sub-minute floor to1m, expired →None.🤖 Generated with Claude Code
resolves #1