A plugin's quota card carries its picture as a stored "file:…" name
(PluginIcon → StoreIcon), and the Usage page draws it. trayIconFile, which
reads the menu bar card's logo, refused every name with a ':' in it, so
the card fell back to the name's first letter. A picture the user gave
their own provider was refused the same way.
trayIconFile now reads a "file:" name as pageIconOf, its sibling for the
day page, does: through provider.IconServed (IconFile's check, 16 hex
digits and a picture's ending, so no path of the caller's own; the
scaled copy for a big PNG/JPEG/WebP), at most maxPageIcon bytes, an SVG's
arc flags spaced out as the bundled ones are. Anything else with a
':', '/' or '\' stays refused.
Ported from sunny0826's fork (tray-plugin-logo, 080c11f98), reviewed for
harm first: no new dependency, network, or path outside the icons
folder. Changed from the fork: IconServed with the size cap and SVG
arc flags in place of a raw IconFile read; the refusal test writes each
file a refused name could reach, so it tests the check, not a missing
file.
Siblings: pageIconOf (day page) already reads stored pictures; app.js's
icon() does too; only the macOS tray draws cell logos, and every tray
goes through trayIconFile.
Run (mote, darwin arm64, at this tree):
- go test ./internal/gui ./internal/provider: ok.
- gofmt -l internal/gui: clean. go vet (darwin), GOOS=linux -tags nogui,
GOOS=windows on internal/gui and internal/provider: ok.
- win-run TestTrayIconFileStored on xiaomi-gpu: ok (internal/gui, -run TestTrayIconFileStored).
Broken by hand:
- trayusage.go at origin/main: TestTrayIconFileStored and
TestTrayImageStoredIcon fail (0 bytes for the stored picture).
- IconServed swapped for filepath.Join(IconDir(), own): the test reads
"file:mine.png", "file:../providers.json" and
"file:0123456789abcdef.exe" and goes red.
Not tried: a real plugin's card in the built app's menu bar (the fork's
author reports it drawn, light and dark); the full suite runs after the tag.
Co-authored-by: Xudong Guo <24563928+sunny0826@users.noreply.github.com>
fflake33 on Discord asked for the pace as a figure, "+12%" or "−8%"
against an even pace through the window, on the Usage cards and in the
menu bar.
- provider: QuotaWindow.Pace(readAt, now) is the share used (0-100) less
the share of the window gone by, from Bounds (reset less span; a
month's window a calendar month); none for an unlimited window, one
whose span or reset isn't known, or outside it. WithWindowStarts sets
startsAt on copies of the cards for the GUI (the caches' cards are
left alone); /api/usage/quotas and its refresh send it.
- Usage page: "Pace +20%" on the reset line after the wait (quotaPace,
paceLine), its sign turned with the meter in Left mode, amber while
more is used than an even pace would have, what it means in its
tooltip. Past cycles and windows with no known start show none.
- Menu bar: Settings > Menu bar pace (settings.TrayPace, off by default;
hidden on Windows, whose tray shows no text) puts " +12%" beside each
figure ("42% −14%", at most 10 runes, trayRowMax) and "pace −14%" in
the tooltip. KeepOwn keeps it device-local like the other tray
settings; the Settings save keeps it (prefsKeep).
- Strings in en, zh, zh-TW, ja, de. gui-shell.md says it.
Run:
- go test -tags nogui ./internal/provider ./internal/gui ./internal/settings
./internal/usage: ok; ./internal/davsync: ok (now covers TrayPace;
red with TrayPace taken out of KeepOwn). go test ./internal/gui -run
Tray (darwin, with the tray image tests): ok.
- New TestWindowPace, TestWithWindowStarts (input not mutated),
TestTrayUsagePace (off unchanged, used and left, rows, tooltip).
- quota-pace.test.cjs, chromium and webkit: 4 pass; cards in en, zh,
zh-TW, ja, de at 1100 and 420px, used and left, amber, tooltips, no
sideways scroll, a click moves nothing; the Settings row in all five
at both widths, On posts trayPace, a currency save keeps it, no
scroll; hidden with no card and on Windows, shown on Linux. Red with
paceLine not called, with trayPace out of prefsKeep, and with the
Left-mode sign not turned.
- gui-de, gui-ja, gui-zh-tw, i18n-keys: 12 pass; tray-bird 6, quota-holds
2, quota-read-at 4 pass.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean.
Not tried: the real menu bar on a Mac or Linux tray.
okingkee on X: three Codex accounts, the menu bar set to follow the account
in use. A used its allowance up and the gateway went on to B, but the menu
bar stayed on A; changing the first account moved it, the gateway moving
on did not. trayInUseCard asked InUseLogin, which reckons from the account
the agent is signed in to, and that lags the gateway (and under Smart it
picks any account).
- provider: SubscriptionQuota gains lastServedAt, set by Quotas
(cardsServed) from served.json the way /v1/magpie/quotas already was,
on this computer's own cards only and on copies, the caches untouched.
withServed's matching moved into servedBy.at, shared by both.
This also makes the Usage page and tray panel's "show the account that
answered last in full" (ae6b4c93) work: it read q.lastServedAt, which the
window's API never sent, so it always showed the first.
- tray: a "<provider>|*" card takes the provider's account that answered
within the last hour (trayServedFresh), else InUseLogin's as before.
Run:
- TestTrayInUseFollowsWhoAnswered (A at 100% answered 40 min ago, B 1 min
ago → B; both stale → InUseLogin's A; one account → it) fails with the
served pick disabled and passes; TestCardsLastServed (subscription by
user, balance with no user, a remote card left alone, inputs unwritten)
passes; TestTrayInUse and TestQuotasLastServed unchanged and pass.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... pass.
- go test ./... passes except internal/gateway, which hit the 10m default
timeout under this machine's load; run alone with -timeout 20m it passes
(726s). No JS changed, so no GUI test run.
* gui: navigate menu-bar quota cells to allowance cards
* gui: fix quota navigation in lightweight and folded views
Route quota hits through the existing status-item monitor rather than relying on local monitor ordering. Recreate released panels through panelWin, and expand hidden accounts before focusing them. Keep panel headers non-draggable and cancel pending navigation after five seconds or purposeful scrolling.
Add a native AppKit subprocess regression that fails with the former nil-panel dereference and verifies runtime-queued focus, closing, and recreation. Extend browser checks for folded accounts, expiry, cancellation, and panel drag state.