Files
magpie/internal/gui/assets
yetone 6bba0572d6 gui: an open editor's readings redraw its accounts list, not the page (#5310)
When a provider editor opens, its accounts' readings load after it
(loginUsageOf), and their arrival called renderProviders(true): every
Providers row and the whole editor drawn again. With 600 accounts that
was a second full draw of the editor. redrawAccounts now draws only the
editor's accounts list again and puts it where the old one was. A full
draw is kept for the cases it was there for: another provider being
edited, a rename or a focused field (left alone, as before), and an
arrangement in progress or no open list (drawn in full).

What a full draw did, the in-place redraw does too:
- the list's inputs are named and described as field() names them;
  that part of field() is now fieldInputs(label, control), shared;
- the focus goes back to the same control of the same account, matched
  by tag and first class (a pressed refresh is "busy", so the whole
  className is not the same after), not its index in the list, which
  the readings' new controls move;
- that focus is given back, not pressed (modalRefocus), so the dialog
  keeps holding the pressed element where it was;
- the body's scroll is put back after the swap: the focused element
  taken out moved it by scroll anchoring (120 to 124 in
  editor-quota-quiet).

The full draw also hid a gap it no longer covers: the provider editor's
folds learn the labels' column from their own size (edAlign's
ResizeObserver), and the prefs fields (Resets, Warm up, Check in,
Claude Code) shown after the prefs load widen that column without
changing a fold's size. The readings' full draw made new folds that
measured it again. mountProvPrefs now aligns the editor's folds after
showing its fields (edAlignAt, the observer's body made a function).

Measured before (mote, 600 Claude accounts): the in-place redraw saves
~45ms in WebKit and ~30ms in Chromium of the editor's open. The rest
of the ~1s is the first layout of 600 rows.

Tests:
- editor-readings-in-place (new): 12 accounts, readings held until the
  editor is open and the 3rd account's first button focused. After
  they arrive the Providers row and the editor's head are the nodes
  drawn before, the focus is that same button, and the list's labels
  match a full renderProviders(true). Chromium and WebKit,
  en/zh/zh-TW/ja/de: 10/10 green.
- editor-quota-quiet's "redrawn" watch also counts the accounts list
  replaced alone; before, it waited for a new .ebody and failed
  "never came, so this tested nothing".

Broken by hand:
- the readings back to renderProviders(true): editor-readings-in-place
  10/10 red on "the provider's row is the one drawn before".
- the focus matched by the whole className: account-refresh-holds
  red in Chromium, "the focus stays on the pressed refresh" (null).
- the refocus without modalRefocus: account-refresh-holds red, "the
  pressed refresh moved 186.875px".
- without the scroll put back: editor-quota-quiet red 8/8, "the body
  keeps its scroll" (124, 120).
- without mountProvPrefs' edAlignAt: editor-advanced-align red in
  Chromium, "en 1000: Advanced starts at 284.765625, its fields at
  349.265625".

Run (mote, load 25-45, other sessions' runs beside):
- account-refresh-holds, claude-quota-onboarding, editor-advanced-align,
  editor-hints, editor-quota-quiet, editor-thumbs-batched, one at a
  time, on this change and on origin/main 2abfe2b64: the same reds on
  both but those this commit fixes, and editor-thumbs-batched (red on
  main, #5886, the next commit). The shared reds are filed:
  account-refresh-holds' rising sheet (#5814), account-arrange (#6010),
  claude-quota-onboarding (#6179), editor-hints in WebKit (#6156).
- the 149 GUI files this reaches, on mote: 2601 pass, 124 fail of 2725.
  Every red is in 16 files, and the same 16 run alone at origin/main
  2abfe2b64 on mote fail the same tests (126 there, the two more being
  signin-proxy at 380px, #5866). Filed: provider-many-keys and
  provider-max-output #6209, key-switch #5835, plugin-signin-no-url #5938,
  plugin-signed-out-account #5998, reset-providers #6196, old-webkit
  #6030/#5919, mobile-web #3952, plugin-move-unserved #4392, key-import
  #6416, account-refresh-holds #5814, account-arrange #6010,
  claude-quota-onboarding #6179, editor-hints #6156. restart-app's
  chromium 420 zh was 1px off once in the full run and green alone on
  both trees (#6417).
- go test ./internal/gui -run 'Budget|I18n|Keys|Words' on mica: ok
  (TestCoreScriptBudget with the previous commit: -89 code bytes over
  both).

At origin/main 70f4593e6 (rebased over 27 commits,
several in app.js): go test ./internal/gui -run
'Budget|I18n|Keys|Words' ok on mote; editor-readings-in-place,
editor-quota-quiet, editor-thumbs-batched, editor-advanced-align,
account-refresh-holds, claude-quota-onboarding, i18n-keys,
signin-proxy, reset-providers and key-import: every red one that is
red on origin/main too, but editor-thumbs-batched's WebKit read
count, which the next commit gives room (red on main as well).
editor-advanced-align was red once in both engines in that set at
--test-concurrency=2 under load, then green alone on this head and on
main, and 58/58 green in the same set again (#6421).

Not tried: the real app with 600 real accounts; Linux WebKitGTK.
2026-11-13 12:20:29 +08:00
..
omarchy: on Omarchy, magpie is drawn in Omarchy's own design language, follows its theme, drops its panel under the bar as Omarchy's own menus do, and can put its icon in Omarchy's bar (让整个UI/UX完全符合Omarchy的设计语言…单独对Omarchy做这个支持,现在的UI/UX当然要保留) — on Hyprland magpie looked like any other GTK app: its own light/dark palette, rounded shadowed popups, and a tray panel floated framed and dimmed in the middle of the screen, labelled with the program's name, never closing on a click elsewhere (focus follows the mouse there, so Wails turns off focus-lost hiding), and its tray icon was hidden in the bar's drawer. Now, only when Omarchy is detected (internal/omarchy: ~/.local/share/omarchy and its current theme), boot.js hands the page the current theme (colors.toml, the shell's theme TOML, Hyprland's border size, colour and rounding, Omarchy's font) as CSS variables before the first paint, and omarchy.css, all under html.omarchy, draws flat as Omarchy's shell does: the theme's background, no shadows or blur, corners as round as Hyprland's windows, popups and dialogs framed by the active border's colour, uppercase letter-spaced labels, rows and picks as a faint fill with the text in the accent. /api/omarchy is polled every 2.5s, so a theme picked in Omarchy's menu reaches the windows at once; Settings → Appearance shows the theme's name instead of Light/Dark/System. Under Hyprland the tray panel gets a title of its own ("magpie panel", set through GTK since Wails leaves frameless windows untitled), and each opening gives Hyprland a named Lua window rule placing it under the bar at the click, 6px in from the edges, pinned, opaque, borderless; its height is capped to the work area. While it is open a non-consuming left-click bind emits a custom event on Hyprland's socket2; a click outside the panel and below the bar closes it (the bar is left to its icons, so the icon toggles), and the bind is removed on close or, after Escape, on the next click. The tray item's SNI id is "magpie" instead of "Wails", so it can be pinned. Settings → Bar icon (状态栏图标), shown only in the app on Omarchy's Hyprland, puts an Omarchy bar-widget plugin (usemagpie.magpie, a bird glyph, in ~/.config/omarchy/plugins, then rescanPlugins and plugin enable) beside Omarchy's own icons: a click runs magpie panel, a right-click magpie app; Off disables and removes it; a widget pointing at a moved or older magpie is rewritten at start. magpie panel (new) opens the quick panel, starting magpie if needed, or toggles it in the running instance. Elsewhere nothing changes. Tested in a Hyper-V VM on the latest Omarchy (Hyprland 0.56, 2528×960 at scale 1.6): the look with tokyo-night; the panel at [1134,32] under the bar; clicks on the panel and the bar keep it open, a click on another window closes it, the icon toggles it, Escape closes it and the bind goes; Bar icon On adds the bird to the bar, its click opens the panel under it (also with magpie not running), a second click closes it, right-click opens the window, Off removes it; autostart becomes app-magpie@autostart through systemd's XDG generator; the launcher entry and icon are there. Go: internal/omarchy tests (theme parsing, panel placement on scaled and turned monitors, click-outside geometry, widget files quoted with the executable, KeepWidget rewriting only a stale one). A new internal/gui/tests/omarchy.test.cjs, Chromium and WebKit, en and zh: with no Omarchy theme the page has no omarchy class or theme style, the Appearance choices show, no Bar icon row, nothing asked of /api/omarchy; with one, the theme's background, square corners, its name, and Bar icon's On and Off each posted with nothing scrolled, hidden when the bar isn't there. old-webkit now lets omarchy.js load in the head beside boot.js (it does nothing off Omarchy). The full GUI suite, gofmt, go vet, go build (GOOS=linux, GOOS=windows) and go test -tags nogui ./... pass. Not tried: other Hyprland setups than Omarchy's, a multi-monitor VM, and the GTK4 build in the VM (gtk3 was used).
2026-09-30 04:58:11 +08:00