From 1ab2c39843a0364e463889a0e9219a78ff0d2b31 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 14 Nov 2026 19:37:33 +0800 Subject: [PATCH] tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X) onkashiko on X: a quota hidden in the main window still showed from the menu bar. 7ea1e6a4b made the tray panel and the TUI leave out Overview-hidden cards and rows, but two gaps were left: - The menu bar's cells, its tooltip and Windows' tray figure still showed a hidden card and its hidden rows. trayUsageCards now goes through trayShown: a cell naming an account takes the card the Overview still shows (its balance with its plan hidden), a cell following the account in use (`|*`) picks that account among every card as before and is left empty while its card is hidden, never moved to another account. Hidden rows are left out, a card never left with none. settings.TrayUsages is untouched, so the cell comes back with the card. - POST /api/usage/arrange now wakes the menu bar (onTrayUsage) when cardsHidden or windowsHidden is sent, so a hide or unhide reaches it at once rather than at the next tick (3 minutes by default). - The panel hid a card after keyCards had put a key's balance on its plan's card, so "Hide its balance from Overview" left the balance on the panel's plan card, and a hidden plan took its unhidden balance with it. panelPageCut now takes the quotas as read and leaves the hidden out before keyCards, as overviewCards does; gone counts a merged card hidden only when its plan and balance both are. The Go hide rule (cardHideKey/usageShown) moved from internal/tui to internal/provider (ShownQuotas, QuotaCardHidden, QuotaRowsShown, QuotaHideKey), shared by the TUI and the menu bar. Not changed: Bark's daily push still warns about a near-limit hidden card (an alert, not a display). Docs: settings.go comments, docs/subsystems/gui-shell.md. Run on mica (mote at load 117 on 18 cores), at base ee6352b63: - go test -count=1 -timeout 45m ./internal/gui ./internal/tui ./internal/provider ./internal/settings: all ok. - go vet of those packages; GOOS=linux go vet -tags nogui and GOOS=windows go vet of internal/gui, internal/tui, internal/provider: clean. gofmt -l clean. - GUI (Chromium + WebKit, en/zh/zh-TW/ja/de): panel-hidden-balance (new), panel-page-hidden, panel-arrange: 28/28. panel-balance-order, usage-rows-hide pass. usage-cards-hide and usage-hidden-way-back are red at "de 560" (no sideways scroll), the same 8 on an origin/main ee6352b63 copy (#6294, #6295). tray-cell-click "chromium zh/en" is red 1 run in 3 on origin/main as on this tree (#5215). Broken by hand: panel-hidden-balance is red on origin/main's assets (the plan card carries the hidden balance, MiniMax's balance gone); TestTrayLeavesOutWhatTheOverviewHides is red with trayShown returning trayPick, TestUsageArrangeWakesTheMenuBar red with the onTrayUsage call removed. At the pushed head (rebased on 534b1a334, which adds installdir_windows.go): GOOS=windows go vet ./internal/gui ./internal/update and go test -run "TestTray|TestUsageArrange|TestCoreScriptBudget" ./internal/gui: ok. Not tried: the real menu bar on a Mac or Windows with a real account; no full go test ./... (a full suite was running on mica). --- docs/subsystems/gui-shell.md | 6 +- internal/gui/api.go | 5 + internal/gui/assets/app.js | 2 +- internal/gui/assets/plugins/usage/page.js | 35 ++++--- .../gui/tests/panel-hidden-balance.test.cjs | 88 ++++++++++++++++++ internal/gui/trayusage.go | 36 +++++++- internal/gui/trayusage_hidden_test.go | 91 +++++++++++++++++++ internal/provider/quota_shown.go | 65 +++++++++++++ internal/settings/settings.go | 10 +- internal/tui/usage_hidden.go | 41 +-------- 10 files changed, 315 insertions(+), 64 deletions(-) create mode 100644 internal/gui/tests/panel-hidden-balance.test.cjs create mode 100644 internal/gui/trayusage_hidden_test.go create mode 100644 internal/provider/quota_shown.go diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index 81288fec9..a5be15914 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -662,9 +662,9 @@ covers it in both engines, every language and a narrow window. - There are no native `