Remove standalone fetcher, add setup tool with install/uninstall workflow
All checks were successful
Release / build (push) Successful in 1m45s

Drop claude-fetcher binary and cron job — the widget's built-in
BackgroundFetcher is the sole fetcher now. Add cmd/setup with cross-platform
install and uninstall (--uninstall): kills widget, removes binaries + autostart,
cleans Claude Code statusline setting, optionally removes config dir.

Also includes: browser-based login (chromedp), ICO wrapper for Windows tray
icon, and reduced icon size (64px).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Axel Meyer
2026-02-26 19:11:08 +01:00
parent 5b0366f16b
commit 47165ce02c
15 changed files with 796 additions and 126 deletions

View File

@@ -17,7 +17,7 @@
## Overview
Three static binaries built from one Go codebase. No runtime dependencies — no Node.js, Python, or system packages needed.
Two static binaries built from one Go codebase. No runtime dependencies — no Node.js, Python, or system packages needed. A `setup` tool handles installation and uninstallation on both platforms.
### CLI Statusline
@@ -27,47 +27,49 @@ Headless status bar for Claude Code. Shows context window utilization and token
Context ▓▓▓▓░░░░░░ 40% | Token ▓▓░░░░░░░░ 19% 78M
```
### Usage Fetcher
Standalone binary for cron. Fetches token usage from the Claude API and writes a shared JSON cache.
### Desktop Widget
System tray icon showing 5-hour usage as a circular progress bar on a Claude starburst logo. Color shifts from green through amber to red as usage increases. Right-click menu shows detailed stats and configuration.
System tray icon showing 5-hour usage as a circular progress bar on a Claude starburst logo. Color shifts from green through amber to red as usage increases. Has a built-in background fetcher that writes a shared JSON cache. Right-click menu shows detailed stats and configuration.
## Topology
```
claude.ai API
──► claude-fetcher (cron) ──► /tmp/claude_usage.json ──► claude-statusline (Claude Code)
└──► claude-widget (built-in fetcher) ──┘──► System tray icon
──► claude-widget (background fetcher) ──► /tmp/claude_usage.json ──► claude-statusline (Claude Code)
──► System tray icon
```
Only one fetcher needs to run. The widget has a built-in fetcher; the standalone `claude-fetcher` is for headless/cron setups. Both write the same cache format.
## Installation
### Windows / Linux (setup tool)
Extract the archive and run the setup tool. It copies binaries to the install directory, enables autostart for the widget, and configures Claude Code's statusline setting.
```bash
# Windows — double-click setup.exe, or from a terminal:
setup.exe
# Linux
./setup
```
### Debian/Ubuntu (.deb)
```bash
sudo dpkg -i claude-statusline_0.3.0_amd64.deb
```
Installs all three binaries to `/usr/bin/`, sets up autostart for the widget, and adds a cron job for the fetcher.
Installs binaries to `/usr/bin/` and sets up autostart for the widget.
### Linux (tar.gz)
### Linux (manual)
```bash
tar xzf claude-statusline_0.3.0_linux_amd64.tar.gz
sudo cp claude-statusline-0.3.0/claude-{statusline,fetcher,widget} /usr/local/bin/
cp claude-statusline-0.3.0/claude-{statusline,widget} ~/.local/bin/
```
### Windows
Extract the `.zip` and place the `.exe` files anywhere on your PATH.
### Session Key Setup
After installing, paste your claude.ai session key:
@@ -98,6 +100,26 @@ Add to your Claude Code settings (`~/.claude/settings.json`):
}
```
## Uninstall
### Windows / Linux (setup tool)
```bash
# Windows
setup.exe --uninstall
# Linux
./setup --uninstall
```
Stops the widget, removes binaries and autostart entry, and cleans the `statusLine` setting from Claude Code. Optionally removes the config directory (interactive prompt, default: keep).
### Debian/Ubuntu
```bash
sudo dpkg -r claude-statusline
```
## Configuration
### Environment Variables
@@ -136,12 +158,12 @@ Right-click the tray icon to access:
```bash
# All binaries
go build ./cmd/statusline && go build ./cmd/fetcher && go build ./cmd/widget
go build ./cmd/statusline && go build ./cmd/widget && go build ./cmd/setup
# Cross-compile for Windows
GOOS=windows GOARCH=amd64 go build -ldflags "-H=windowsgui" -o claude-widget.exe ./cmd/widget
GOOS=windows GOARCH=amd64 go build -o claude-statusline.exe ./cmd/statusline
GOOS=windows GOARCH=amd64 go build -o claude-fetcher.exe ./cmd/fetcher
GOOS=windows GOARCH=amd64 go build -o setup.exe ./cmd/setup
# Build .deb
VERSION=0.3.0 nfpm package --config packaging/nfpm.yaml --packager deb
@@ -152,17 +174,17 @@ VERSION=0.3.0 nfpm package --config packaging/nfpm.yaml --packager deb
```
cmd/
statusline/main.go # CLI statusline (reads stdin + cache)
fetcher/main.go # Standalone cron fetcher (writes cache)
widget/main.go # Desktop tray widget entry point
widget/main.go # Desktop tray widget with built-in fetcher
setup/main.go # Cross-platform install/uninstall tool
internal/
config/config.go # Shared config (session key, org ID, intervals)
fetcher/fetcher.go # HTTP fetch logic (shared between widget + standalone)
fetcher/fetcher.go # HTTP fetch logic (used by widget)
fetcher/cache.go # JSON cache read/write (/tmp/claude_usage.json)
renderer/renderer.go # Icon rendering: starburst + arc (fogleman/gg)
tray/tray.go # System tray setup + menu (fyne-io/systray)
packaging/
nfpm.yaml # .deb packaging config
linux/ # .desktop file, cron, install scripts
linux/ # .desktop file, install scripts
```
## License