Files
magpie/internal/gui/assets
如是 e119470a70 gui: the ZCode plugin's claim line is translated — its name is a sentence magpie knows, its count and plan name are data (#1244)
* gui: the ZCode plugin's claim line is translated — its name is a sentence magpie knows, its count and plan name are data

The ZCode plugin's card gets a line when the app holds a gift plan the
account hasn't been granted yet. It was a window named after the plan and
displaying "1 to claim · claim it in the ZCode app", which stayed English
on a Chinese interface: a window's display is shown as it came
(quotaCount returns w.display for a window with no limit, app.js) and only
its name goes through t() — on the card, in the tips and in the chart. The
plugin cannot know the interface's language (host.js and provider.Provider
hand it no locale) and magpie's translation is keyed by the string, so the
sentence has to be the name. The plugin's own change is
magpie-community/plugins#43: the window is named "Gift plans to claim in
the ZCode app" and the display carries "1 · ZCode Trust Build" — one name
for any count, and the plan's name as the vendor gave it.

zh, zh-TW, ja and de each get that name: 有赠送额度待领取 · 请在 ZCode
客户端领取, 有贈送額度待領取 · 請在 ZCode 用戶端領取, 受け取り待ちのギフト
枠があります · ZCode クライアントで受け取ってください, Geschenk-Kontingente
zum Abholen in der ZCode-App (yetone/magpie#1001).

quota-name-translated.test.cjs is new and holds the rule itself, not just
this line: a window whose name is a sentence magpie knows and whose
display is the plugin's own, in English and Chinese, Chromium and WebKit —
the name reads in the language, the display does not. It fails on the two
Chinese runs without the zh entry. gui-de/gui-ja/gui-zh-tw keep every zh
string covered, and i18n-keys.test.cjs passes.

* gui: the claim line's translations fit the card at 560px, and the test checks every language at 440 and 560

The names added for "Gift plans to claim in the ZCode app" were too long for
the card: .quota-labels > span is nowrap with no ellipsis and no tooltip, so
anything wider than its .quota is cut off mid-word with nothing saying so
(yetone on #1001, measured in en/zh/zh-TW/ja/de at 360–1000px in both
engines). ja was the worst — cut by 79px at the default 660px window and
129px at 560 — with de cut at 560 and zh/zh-TW at 440.

Every language is now a shorter sentence, checked in the real page at 440
and 560px in Chromium and WebKit: nothing overflows and nothing is clipped.
en is unchanged (it is the key, and it fits at 440). zh/zh-TW drop the
"· 请在…领取" clause for a leading "待在…领取的"; ja uses the wording
suggested in review; de likewise.

quota-name-translated.test.cjs now covers every language magpie has, not
only en and zh, and renders each at 440, 560 and 1000px rather than 1000
alone — the width that could never catch this — asserting the name's right
edge stays inside its .quota and that it isn't clipped. Red/green: with the
previous long wording restored, the fit assertion fails with the measured
overflow (zh and zh-TW by 14px at 440, ja by 189px, de by 68px); with the
new wording all ten pass. i18n-keys, gui-de, gui-ja and gui-zh-tw pass.

* gui: the claim-line test's README says what it covers, and its fit check measures the box

Two things from review (#1001): the README paragraph still said "in
English and Chinese" and said nothing about the widths, though the test
now covers every language magpie has at 440, 560 and 1000px — a
translated name is a sentence and .quota-labels > span is nowrap with no
ellipsis, so the width is the point of the test, and 1000 alone could
never catch a name that is too wide.

And the fit check read `s.scrollWidth > s.clientWidth + 1`, which is
always false on an inline span: the dead half is gone and the name's own
box is compared with its .quota instead, which is what actually catches a
cut name (the `over` value beside it was doing the work). Red/green, with
the long wording restored: "the name is cut off at 440px: 14px past its
quota, wider=true" (zh, zh-TW), 189px (ja), 68px (de).
2026-10-09 12:35:34 +08:00
..
gui: the page runs in macOS 12's WebKit — no regex lookbehind, the few newer built-ins filled in, fallbacks for container queries, subgrid, :has and color-mix (#220 uclort: on macOS 12.7.6 the app opened blank, the panel showing its tab bar, a "Profiles + Save current" heading and "Open magpie · Quit" and nothing else, no button working) — the page runs in the system's WebKit, on macOS 12 Safari 15.x's, and app.js's snippet highlighter had a regex lookbehind, (?<==)\S+ (app.js:2167), which WebKit only parses from Safari 16.4: a SyntaxError in a literal fails the whole file, so app.js never ran (and routing.js and library.js, which lean on it, threw), leaving index.html's static markup; library.js had two more, (?<![\w-]) in the SVG greying (library.js:162-163). The highlighter now finds a value after "=" by hand (the character before the match, a sticky \S+) and the greying checks the character before a colour name in its replace callback, each giving the same output as before (compared on shell, curl, Python and Node snippets and an SVG with attribute and style colours, data-fill and x-color left alone). Built-ins newer than Safari 15.0 in use, routing.js:307's findLast and library.js:1042's structuredClone (15.4), are filled in by a new compat.js loaded before the other scripts (with at, findLastIndex and Object.hasOwn), each only where missing; structuredClone there is a JSON copy, enough for the API's plain data. Styles: a selector list with :focus-visible (15.4) drops the whole rule before 15.4, so the agent handle's hover, an account's Remove and protocol buttons showing on hover, the protocol menu's hover and the editor's focus ring are split from their :focus-visible (or it is dropped where :focus covers it); .acc:has(.aq) and the panel's .profiles:has(> .chip-input) hint (15.4) are classes set by app.js (with-aq, naming); the Routing page's container queries and the request list's subgrid (16) get @supports not fallbacks by the window's width (the tray panel is narrower than all of them) and a row's own columns; and the panel's --panel-tint, a color-mix() (16.2) in a custom property that would have gone invalid and painted the panel clear (tintPanel then handing the system white under dark text), falls back to --bg, as the floating status and Library's sticky head do. Other things newer than 15.0 are left as cosmetic: inert (15.5) on the folded agent list, accent-color, the rest of color-mix() on hover and focus shades, .quota's subgrid rows. The build: Go 1.25 and later run on macOS 12 and up only (the linker stamps 12.0 as the oldest), so Info.plist's LSMinimumSystemVersion and the Makefile's -mmacosx-version-min go from 11.0 to 12.0 and the site says macOS 12+ rather than 11+. Tested with a new internal/gui/tests/old-webkit.test.cjs: every assets/*.js parsed with the Babel parser Playwright bundles, failing on a regex lookbehind, v flag or modifiers (in a literal or new RegExp("…")), a class static block, decorators, import attributes or using (checked against the old highlighter's regex and a static block, and not on named groups, lookahead, ??= or private methods); a grep for built-ins newer than 15.0 (at, findLast, structuredClone, hasOwn, toSorted and co., Set methods, groupBy, withResolvers, Iterator helpers, popover …) unless compat.js fills them in (fails on main's routing.js:307 and library.js:1042 without it); compat.js the first of the page's scripts and every script loaded; the CSS with no :has(), no :focus-visible in a mixed list, no nesting or dvh, and @container, subgrid columns and a color-mix() custom property only with an @supports not fallback in the same file; and, in WebKit with those built-ins deleted, the panel's tabs, Save current's name field and every window page drawn with no page error. Documented in internal/gui/tests/README.md. go build -tags nogui (and GOOS=linux, GOOS=windows), go build (darwin GUI), go test -tags nogui ./... and the whole GUI suite (130 tests) pass. Not tried on a real macOS 12 or Safari 15: the old engine's parse is judged by the parser, not run.
2026-09-29 23:52:38 +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