diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index 9ce43792f..c618daa92 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -202,7 +202,7 @@ body.window.mac .seg { top: calc(50% + 1px / var(--zoom, 1)); } /* 50% centres i
.brand { display: flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: .01em; }
body.window:not(.mac):not(.linux):not(.web) .brand { display: none; } /* Windows' title bar above already shows the icon and the name; a browser tab has no title bar of the app's */
/* app.js removes these controls later; keep them out of the first paint too. */
-body.window :is(#open, #openMain, #quit),
+body.window :is(#open, #quit),
body:not(.window.linux) #winclose { display: none; }
/* Linux: the header is the title bar, so it closes the window too — round,
as GNOME draws its close button, and set a little apart from the icons */
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 93585709c..1315982e4 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -23546,13 +23546,12 @@ $("#sync").onclick = async () => {
}
};
$("#open").onclick = () => api("window/main", {});
-$("#openMain").onclick = () => api("window/main", {});
$("#quit").onclick = () => api("window/quit", {});
$("#winclose").onclick = () => winRuntime.then((w) => w?.Window.Close()); // hides it: the tray stays
$(".top").addEventListener("dblclick", (e) => {
if (document.body.classList.contains("linux") && !e.target.closest("button, nav")) winRuntime.then((w) => w?.Window.ToggleMaximise());
});
-if (mode === "window") { $("#open").remove(); $("#openMain").remove(); $("#quit").remove(); }
+if (mode === "window") { $("#open").remove(); $("#quit").remove(); }
else { $("#nav").remove(); $("#side").remove(); }
if (mode !== "window" || !document.body.classList.contains("linux")) $("#winclose").remove();
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 0f2ca7775..9149389b0 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -496,7 +496,6 @@ const I18N = {
"Usage refreshed": "用量已刷新",
"Allowances refreshed": "额度已刷新",
"Open as a window": "在窗口中打开",
- "Open magpie": "打开 magpie",
"Quit": "退出",
"Filter…": "筛选…",
@@ -4696,7 +4695,6 @@ const I18N = {
"Usage refreshed": "用量已重新整理",
"Allowances refreshed": "額度已重新整理",
"Open as a window": "在視窗中開啟",
- "Open magpie": "開啟 magpie",
"Quit": "退出",
"Filter…": "篩選…",
"No agents found": "沒有找到 Agent",
@@ -8859,7 +8857,6 @@ const I18N = {
"Usage refreshed": "使用量を更新しました",
"Allowances refreshed": "利用枠を更新しました",
"Open as a window": "ウィンドウで開く",
- "Open magpie": "magpie を開く",
"Quit": "終了",
"Filter…": "絞り込み…",
"No agents found": "エージェントが見つかりません",
@@ -13039,7 +13036,6 @@ const I18N = {
"Usage refreshed": "Nutzung aktualisiert",
"Allowances refreshed": "Kontingente aktualisiert",
"Open as a window": "Als Fenster öffnen",
- "Open magpie": "magpie öffnen",
"Quit": "Beenden",
"Filter…": "Filtern…",
"No agents found": "Keine Agenten gefunden",
diff --git a/internal/gui/assets/index.html b/internal/gui/assets/index.html
index 31f403bb8..470f4369d 100644
--- a/internal/gui/assets/index.html
+++ b/internal/gui/assets/index.html
@@ -455,7 +455,6 @@
-
diff --git a/internal/gui/tests/panel-open-once.test.cjs b/internal/gui/tests/panel-open-once.test.cjs
new file mode 100644
index 000000000..33e67f53a
--- /dev/null
+++ b/internal/gui/tests/panel-open-once.test.cjs
@@ -0,0 +1,67 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// The tray panel opens the main window from one place: the header's
+// open-as-a-window icon. Its foot had an "Open magpie" button too, which did
+// the same (yogurt36 on Discord); the foot keeps Profiles, the status line
+// and Quit, which are its own.
+const assert = require("node:assert/strict");
+const fs = require("node:fs/promises");
+const path = require("node:path");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+
+const assets = path.resolve(__dirname, "../assets");
+
+function handler(lang, calls) {
+ const state = { agents: [{ id: "codex", name: "codex", path: "/test/codex", fields: [] }], profiles: [], settings: { lang, theme: "light" } };
+ return async (route) => {
+ const url = new URL(route.request().url());
+ const json = (data) => route.fulfill({ json: data });
+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state") return json(state);
+ if (url.pathname === "/api/window/main" || url.pathname === "/api/window/quit") { calls.push(url.pathname); return route.fulfill({ status: 204 }); }
+ if (url.pathname === "/api/window/fit") return route.fulfill({ status: 204 });
+ if (url.pathname === "/api/gateway/history") return json({ cut: false, days: [], routes: [] });
+ if (url.pathname === "/api/usage/quotas") return json([]);
+ if (url.pathname === "/api/groups") return json({ groups: [] });
+ if (url.pathname === "/api/providers") return json({ providers: [], gateway: { running: true, window: true } });
+ if (url.pathname.startsWith("/api/")) return json({});
+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
+ await route.fulfill({ body: await fs.readFile(file), contentType });
+ };
+}
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
+ test(`${engine} ${lang}: the tray panel opens the window from one button`, async (t) => {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const page = await (await browser.newContext({ viewport: { width: 380, height: 520 }, reducedMotion: "reduce" })).newPage();
+ page.setDefaultTimeout(8000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ const calls = [];
+ await page.route("**/*", handler(lang, calls));
+ await page.goto("http://magpie.test/?mode=panel");
+ await page.locator("#agents .row.agent").first().waitFor();
+
+ // the header's icon opens the window
+ await page.locator(".top #open").click();
+ for (let i = 0; i < 100 && !calls.length; i++) await page.waitForTimeout(50);
+ assert.deepEqual(calls, ["/api/window/main"], "the header's icon opens the window");
+
+ // and the foot has no second way to it: Profiles and Quit are its only buttons
+ const foot = await page.locator(".foot button").evaluateAll((bs) => bs.map((b) => b.id));
+ assert.deepEqual(foot, ["profBtn", "quit"], "the foot's buttons");
+
+ // the foot keeps Quit, worded in the panel's language
+ const quit = page.locator(".foot #quit");
+ assert(await quit.isVisible(), "Quit stays in the foot");
+ const want = { en: "Quit", zh: "退出", "zh-TW": "退出", ja: "終了", de: "Beenden" }[lang];
+ assert.equal((await quit.textContent()).trim(), want);
+ assert.equal(await page.locator("#openMain").count(), 0);
+ assert.deepEqual(errors, []);
+ });
+ }
+}