Skip to content

feat: multi-account, configure window, escalating notifications, polished installer#2

Open
psychofict wants to merge 1 commit intoStaticB1:mainfrom
psychofict:feat/multi-account-and-configure
Open

feat: multi-account, configure window, escalating notifications, polished installer#2
psychofict wants to merge 1 commit intoStaticB1:mainfrom
psychofict:feat/multi-account-and-configure

Conversation

@psychofict
Copy link
Copy Markdown
Collaborator

Summary

Adds nine features to the widget while preserving single-account behaviour when only one account is configured.

  • Multi-account — tray label aggregates across configured accounts (Work:67% Personal:12%); per-account Claude config dir; per-account Hide from tray and No poll flags.
  • Configure window — tray menu → Configure… opens a tabbed Gtk window for editing accounts, thresholds, poll interval, and burn-rate alerts. Live-applies, no restart.
  • Notification escalation — warn → critical → 100% tiers per window per account, persisted across restarts so a mid-window relaunch doesn't re-fire alerts. Re-arms when the window's resets_at shifts.
  • Burn-rate alerts — configurable multiplier; 8-hour grace at the start of each new 7d window to avoid false alarms on low-elapsed-time data.
  • Graceful failure UX! for auth/network/rate errors, ? for the brief gap between rollover and fresh data; last-known % preserved so transient blips don't blank the indicator.
  • Compact reset times — countdown (2h 15m) when polling, absolute (9:00P / Th 7:00P) when polling is disabled for that account.
  • Interactive installer — asks how many accounts to monitor, gathers label + claude_dir + creds.json check per account.
  • pyenv detection--copies venv that survives pyenv version switches; PyGObject pinned <3.51 on Ubuntu 22.04.
  • Uninstaller — explicit prompt before removing user config.

Architecture changes

The single `claude_usage_widget.py` becomes four files:

  • `claude_usage_widget.py` — indicator + poll loop only
  • `shared.py` — config schema + utility helpers
  • `config_window.py` — Configure UI
  • `usage_popup.py` — details popup

Notable: v1.0.4's Preserve cached data during 429 rate limit overlaps the broader cache-preservation logic introduced here, so the older narrow form has been superseded.

Test plan

  • Single-account install (default) launches and shows tray label as before.
  • Multi-account: configure 2 accounts via Configure… → tray shows acc1:NN% acc2:NN%.
  • Toggle Hide from tray on one account → it disappears from the label, stays in the popup.
  • Toggle No poll on one account → reset time switches from countdown to absolute clock.
  • Threshold notifications fire once each at warn/critical/100%; no re-fire after a process restart within the same window.
  • Burn-rate alerts: enable in Configure, set multiplier to 1.0, confirm a notification once 8h have elapsed in the 7d window.
  • Failure states: kill network → label shows !; restore → previous % returns; force a window rollover → ? shows briefly until next fetch.
  • `install.sh` interactive flow asks for account count and per-account creds path.
  • `install.sh` on a system with pyenv creates a `--copies` venv; switching pyenv version after install does not break the launcher.
  • `uninstall.sh` prompts before removing `~/.config/claude-usage-widget/`.

…shed installer

Adds nine features to the widget. Single-account behaviour is preserved
when only one account is configured.

Features:
  - Multi-account: tray label aggregates across configured accounts
    (Work:67% Personal:12%); per-account Claude config dir; per-account
    hide-from-tray and disable-polling flags.
  - Configure window: tray menu → Configure… opens a tabbed Gtk window
    for editing accounts, thresholds, poll interval, burn-rate alerts.
    Live-applies, no restart.
  - Notification escalation: warn → critical → 100% tiers per window
    per account, persisted across restarts so a mid-window relaunch
    doesn't re-fire alerts. Re-arms when the window's resets_at shifts.
  - Burn-rate alerts: configurable multiplier, 8-hour grace at start
    of new 7d window to avoid false alarms on low-elapsed-time data.
  - Graceful failure UX: ! for auth/network/rate errors, ? for the
    brief gap between rollover and fresh data; last-known % preserved
    so transient blips don't blank the indicator.
  - Compact reset times: countdown (2h 15m) when polling, absolute
    (9:00P / Th 7:00P) when polling is disabled for that account.
  - Interactive installer: asks how many accounts to monitor, gathers
    label + claude_dir + creds.json check per account.
  - pyenv detection: --copies venv that survives pyenv version
    switches; PyGObject pinned <3.51 on Ubuntu 22.04.
  - Uninstaller: explicit prompt before removing user config.

Architecture changes:
  - Split out shared.py (config + utility functions),
    config_window.py (Configure UI), usage_popup.py (details popup)
    to keep claude_usage_widget.py focused on the indicator + poll loop.
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