Skip to content

feat: cross-platform tray / menu-bar app showing today's spend#39

Open
jakduch wants to merge 5 commits into
josepe98:mainfrom
jakduch:feat/tray-app
Open

feat: cross-platform tray / menu-bar app showing today's spend#39
jakduch wants to merge 5 commits into
josepe98:mainfrom
jakduch:feat/tray-app

Conversation

@jakduch
Copy link
Copy Markdown
Collaborator

@jakduch jakduch commented May 23, 2026

What does this add and why do you believe it belongs in this dashboard?

This adds a cross-platform tray / menu-bar companion that surfaces today's Claude Code spend right in the system tray (Linux/Windows) or macOS menu bar, with a single click to open the full dashboard in the browser.

The case for it fitting a personal Claude Code usage dashboard: cost awareness only changes behaviour when it is glanceable. Opening the dashboard is a deliberate act — by the time a heavy day is noticed, the spend has already happened. A persistent indicator turns that into ambient feedback: the running dollar figure is always in the corner of the screen, colour-coded green / amber / red against the existing $1 and $10 thresholds, and refreshed every 60 seconds from the dashboard’s own /api/data endpoint. No new server, no new data path, no duplicate pricing logic — it reuses pricing.calc_cost and the running dashboard as the single source of truth. Clicking the indicator opens the dashboard for the full drill-down. Both backends (rumps on macOS, pystray elsewhere) are optional and lazy-imported, so nothing changes for users who don’t opt in.

Checklist

Code correctness

  • All calcCost() calls pass 6 arguments: (model, inp, out, cache_read, cache_creation, cache_1h)
  • JavaScript template literals use bare backticks (`), not escaped ones (\`)
  • No JS variables referenced before they are defined
  • No new third-party dependencies introduced

Tests

  • python3 -m unittest discover -s tests -v — all passing
  • python3 -m unittest tests.test_browser -v — all passing
  • New behaviour is covered by at least one test

Scope

  • This is a single concern — one feature or fix per PR
  • Only touches existing files (dashboard.py, scanner.py, cli.py, pricing.py, cowork.py, tests/) — or I’ve explained below why a new file is needed

tray.py is a new top-level module. It is isolated by design: the tray UI is an optional, lazily-loaded companion process with its own platform backends (rumps / pystray), and putting it next to cli.py keeps dashboard.py and scanner.py free of GUI concerns. tests/test_tray.py is added alongside it. No third-party imports are added at module top level — both GUI libraries are imported inside run() so import tray always succeeds (CI, headless dev, users who never enable it).

jakduch added 2 commits May 23, 2026 20:12
Adds 'python cli.py tray' — a glanceable menu-bar icon that polls
the running dashboard every 60s and shows today's + this month's
Claude spend in a dropdown, with a one-click 'Open Dashboard'.

- macOS: rumps (native NSStatusBar)
- Linux / Windows: pystray + Pillow
- Both backends optional & lazy-imported (import tray always works)
- Optional badge colour: green < $1, amber $1-$10, red > $10

Files:
  tray.py            — new module, ~300 LOC, two backends + pure helpers
  cli.py             — new 'tray' command with --url override
  tests/test_tray.py — 19 tests (lazy import, helpers, CLI wiring, polling)
  README.md          — new 'Menu bar app' section with install + usage

No new hard dependencies — rumps/pystray are optional extras the user
installs only if they want the tray feature.
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
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.

2 participants