Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
A smaller computers strip you can hide, and the sidebar's colour and picture in Simple's General settings (#3861)
Milind Soni66c4876e8040
diff --git a/docs/verification/README.md b/docs/verification/README.mdindex 7b04cab28b..2bee042d5b 100644--- a/docs/verification/README.md+++ b/docs/verification/README.md@@ -159,8 +159,8 @@ The [personal Cloud account smoke](cloud-account.md) checks optional browsersign-in, server-verified Pro status and sign-out in a disposable Electron profile.The [rail of Clouds](cloud-rail.md) checks the session's list of Clouds, which-pages may read the rail, opening a place by its id, and buying another Cloud,-with a loopback Admin and the real app in a disposable preview.+pages may read the rail, opening a place by its id, hiding the rail, and buying+another Cloud, with a loopback Admin and the real app in a disposable preview.The [embedded server recovery smoke](desktop-server-recovery.md) crashes realElectron-owned fixture servers, verifies bounded recovery and private access,diff --git a/docs/verification/cloud-rail.md b/docs/verification/cloud-rail.mdindex 5997a704f9..a64658f840 100644--- a/docs/verification/cloud-rail.md+++ b/docs/verification/cloud-rail.md@@ -10,9 +10,11 @@ The rail is the window's own chrome, not a page's: this app's page `/rail` in aview of its own at the left edge (electron/chrome-rail.mjs), beside whicheverplace's page the window shows, at every width and on every place, whatever thatserver runs. The page beside it moves over by the rail's width (the app's-preload, at any zoom). The rail's sheets cover the window while open. The place-on screen is named under its circle, and beside the rail the sidebar's switcher-and the profile menu's Switch to… step aside.+preload, at any zoom). The rail's sheets cover the window while open. Its+circles are small and named on hover; the place on screen wears a ring. Beside+the rail the sidebar's switcher and the profile menu's Switch to… step aside.+The person can hide the rail; the page then has the whole window, and those two+come back.Nothing here needs a real MausBot Cloud account, a payment or the Electron app.## Contract@@ -24,6 +26,21 @@ Nothing here needs a real MausBot Cloud account, a payment or the Electron app.named and coloured by the Admin, opened like a team's Cloud: the window pairsit through the Admin's `pairing` with that Cloud's id and takes only a grantfor its own address. My Cloud stays the one home.+- The person hides the rail and shows it again with a button at the left of the+ sidebar's top row, right after the macOS traffic lights (on the same spot+ either way: the app's preload tells the page how far it moved, in+ `--rail-beside`), or with the "Show your computers" switch in Settings+ (Simple: General → Appearance; Advanced: Appearance). Both are there only+ while the window has a rail. The choice is this desktop's (`railHidden` in+ desktop-prefs.json), never a server's or a place's.+- The page beside the rail offers that button through `window.ogb.rail`+ (`state`, `setHidden`, `onState`; its main frame only, and a server's page+ only from the person's click), and learns only whether there is a rail and+ whether it is hidden. Main hides the rail only beside a document that offered+ the button: after the page navigates, reloads, crashes or shows an error page,+ a hidden rail waits 5 seconds for the new document to offer it and comes back+ if none does (an older Cloud or server of the person's own), without changing+ the choice. It comes back too while the page stops responding.- The rail's list carries names, colours and states, never an address, and goesonly to the rail's own page. No place's page reads it, not even thiscomputer's or a Cloud's; a page learns only that the rail stands beside it. A@@ -71,8 +88,8 @@ Nothing here needs a real MausBot Cloud account, a payment or the Electron app.## Automated fixtures```sh-node --test electron/cloud-list.node-test.mjs electron/cloud-account-clouds.node-test.mjs electron/cloud-rail.node-test.mjs electron/chrome-rail.node-test.mjs electron/home-window.node-test.mjs electron/place-look.node-test.mjs-pnpm exec vitest run src/components/PlacesRail.test.ts src/components/ChromeRail.test.ts src/components/cloud-buy/AddCloudFlow.test.ts src/components/PlaceLookCard.test.ts+node --test electron/cloud-list.node-test.mjs electron/cloud-account-clouds.node-test.mjs electron/cloud-rail.node-test.mjs electron/chrome-rail.node-test.mjs electron/home-window.node-test.mjs electron/place-look.node-test.mjs electron/desktop-prefs.node-test.mjs+pnpm exec vitest run src/components/PlacesRail.test.ts src/components/ChromeRail.test.ts src/components/ChromeRailToggle.test.ts src/components/Sidebar.header.test.ts src/components/cloud-buy/AddCloudFlow.test.ts src/components/PlaceLookCard.test.tspnpm exec vitest run server/workspace-banner.test.ts server/routes/workspace-banner.test.ts server/workspace-banner.e2e.test.ts src/lib/place-banner.test.ts src/components/PlacePicture.test.ts```@@ -85,7 +102,9 @@ when the Admin refuses, and that the tint follows at once. The banner testsrun pictures a real encoder made, carrying EXIF, ICC, XMP and text, throughthe server's checks, and a real Team Cloud where its Super admin sets thebanner, a member sees it but can't change it, and a signed-out request gets-nothing.+nothing. The hiding tests run the rail beside a page that offers the button in+time, one that doesn't, one that hangs, crashes or fails to load, and main's+own wiring of the choice.## Rendered workflow@@ -107,15 +126,26 @@ sidebar and in Settings, each in the Daylight and Midnight skins. The`computer` views are this computer's own page on a desktop with no Cloudinstead: the sidebar plain, in a colour and with a picture, the Appearance cardin Advanced and Simple mode, and its circle and menu with the rail beside it.-`--only rail,look-settings` limits it to some views and `--size 1338x870` sets-the window (1280x800 by default). Without `--shots` it prints the preview's-address and waits for Ctrl-C.+The `rail-hidden` views start with the rail hidden, the `rail-icons` ones with+the sidebar showing only avatars, and `strip-settings` opens Settings at the+rail's switch. The rail in these pictures is drawn on the page itself, as on an+older app; the `rail-chrome` views stand in for the window's own rail instead+(the room the app's preload leaves for it, with nothing drawn there), and the+script fails if the sidebar's button for the rail is not on the same spot with+the rail shown and hidden, in either. `--only rail,look-settings` limits it to+some views and `--size 1338x870` sets the window (1280x800 by default). Without+`--shots` it prints the preview's address and waits for Ctrl-C.This computer's card, with no colour or picture yet(`evidence/sidebar-look-everyone/`):+The sidebar's button for the rail, with the rail shown and hidden+(`evidence/rail-collapse/`):+++This is not production qualification: the places and the purchase are thepreview's fixtures, and no Admin, browser checkout or desktop window isinvolved.diff --git a/docs/verification/evidence/rail-collapse/after-button-spot-daylight.png b/docs/verification/evidence/rail-collapse/after-button-spot-daylight.pngnew file mode 100644index 0000000000..7babde280bBinary files /dev/null and b/docs/verification/evidence/rail-collapse/after-button-spot-daylight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-hidden-advanced-midnight.png b/docs/verification/evidence/rail-collapse/after-hidden-advanced-midnight.pngnew file mode 100644index 0000000000..f2c924641bBinary files /dev/null and b/docs/verification/evidence/rail-collapse/after-hidden-advanced-midnight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-hidden-simple-daylight.png b/docs/verification/evidence/rail-collapse/after-hidden-simple-daylight.pngnew file mode 100644index 0000000000..2f076866bcBinary files /dev/null and b/docs/verification/evidence/rail-collapse/after-hidden-simple-daylight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-icons-advanced-midnight.png b/docs/verification/evidence/rail-collapse/after-icons-advanced-midnight.pngnew file mode 100644index 0000000000..d8467d37feBinary files /dev/null and b/docs/verification/evidence/rail-collapse/after-icons-advanced-midnight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-icons-simple-daylight.png b/docs/verification/evidence/rail-collapse/after-icons-simple-daylight.pngnew file mode 100644index 0000000000..989ff75f29Binary files /dev/null and b/docs/verification/evidence/rail-collapse/after-icons-simple-daylight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-rail-advanced-midnight.png b/docs/verification/evidence/rail-collapse/after-rail-advanced-midnight.pngnew file mode 100644index 0000000000..77f0dabaebBinary files /dev/null and b/docs/verification/evidence/rail-collapse/after-rail-advanced-midnight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-rail-simple-daylight.png b/docs/verification/evidence/rail-collapse/after-rail-simple-daylight.pngnew file mode 100644index 0000000000..8498a93d03Binary files /dev/null and b/docs/verification/evidence/rail-collapse/after-rail-simple-daylight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-settings-advanced-midnight.png b/docs/verification/evidence/rail-collapse/after-settings-advanced-midnight.pngnew file mode 100644index 0000000000..6c22febcbbBinary files /dev/null and b/docs/verification/evidence/rail-collapse/after-settings-advanced-midnight.png differdiff --git a/docs/verification/evidence/rail-collapse/after-settings-simple-daylight.png b/docs/verification/evidence/rail-collapse/after-settings-simple-daylight.pngnew file mode 100644index 0000000000..8238cb09a2Binary files /dev/null and b/docs/verification/evidence/rail-collapse/after-settings-simple-daylight.png differdiff --git a/docs/verification/evidence/rail-collapse/before-looks-simple-daylight.png b/docs/verification/evidence/rail-collapse/before-looks-simple-daylight.pngnew file mode 100644index 0000000000..fa15cc50d6Binary files /dev/null and b/docs/verification/evidence/rail-collapse/before-looks-simple-daylight.png differdiff --git a/docs/verification/evidence/rail-collapse/before-rail-advanced-midnight.png b/docs/verification/evidence/rail-collapse/before-rail-advanced-midnight.pngnew file mode 100644index 0000000000..862a4887e4Binary files /dev/null and b/docs/verification/evidence/rail-collapse/before-rail-advanced-midnight.png differdiff --git a/docs/verification/evidence/rail-collapse/before-rail-simple-daylight.png b/docs/verification/evidence/rail-collapse/before-rail-simple-daylight.pngnew file mode 100644index 0000000000..cf6aa9ef65Binary files /dev/null and b/docs/verification/evidence/rail-collapse/before-rail-simple-daylight.png differdiff --git a/docs/verification/evidence/rail-collapse/before-settings-simple-daylight.png b/docs/verification/evidence/rail-collapse/before-settings-simple-daylight.pngnew file mode 100644index 0000000000..86820af237Binary files /dev/null and b/docs/verification/evidence/rail-collapse/before-settings-simple-daylight.png differdiff --git a/electron/chrome-rail.d.mts b/electron/chrome-rail.d.mtsindex b7bea37079..045d0e6ac2 100644--- a/electron/chrome-rail.d.mts+++ b/electron/chrome-rail.d.mts@@ -1,5 +1,20 @@export declare const CHROME_RAIL_WIDTH: number;export declare const CHROME_RAIL_PATH: string;+export declare const RAIL_OFFER_GRACE_MS: number;+/** What the page beside the window's rail knows of it: whether this window has one (two places or more) and whether the+ * person hid it. Never the places on it. */+export interface ChromeRailState { available: boolean; hidden: boolean }+/** `window.ogb.rail`. The page beside the rail offers the button that hides and shows it: `state()` from a document is+ * that offer, and main hides the rail only beside a document that made it. `expand` and `onSkin` are the rail's own+ * page's, on this app's pages only. Each is absent on an older app. */+export interface ChromeRailBridge {+ state?(): Promise<ChromeRailState>;+ /** From the person's click. */+ setHidden?(hidden: boolean): Promise<ChromeRailState>;+ onState?(callback: (state: ChromeRailState) => void): () => void;+ expand?(on: boolean): Promise<void>;+ onSkin?(callback: (skin: string) => void): () => void;+}export interface ChromeRail {attach(window: unknown): void;refresh(): void;@@ -16,5 +31,7 @@ export declare function createChromeRail(deps: {args: () => string[];url: () => string;wanted: () => boolean;+ prefs?: () => { railHidden(): boolean; setRailHidden(hidden: boolean): void } | null;+ changed?: () => void;log?: (line: string) => void;}): ChromeRail;diff --git a/electron/chrome-rail.mjs b/electron/chrome-rail.mjsindex 98acc9c74c..b09561a4ee 100644--- a/electron/chrome-rail.mjs+++ b/electron/chrome-rail.mjs@@ -6,9 +6,17 @@// and the app's preload, which every page in the window gets, moves the page over by that much at any zoom. The rail's// sheets (+, the list past eight) open over the whole window: while one is open the view covers the window,// transparent but for the sheet, and goes back to its strip when it closes.+//+// The person may hide it with a button on the page beside it. That page may be a Cloud or a server of their own on an+// older release with no such button, so the rail hides only beside a document that offered one; a new document has a+// few seconds to offer it, and the rail comes back beside one that doesn't, or that stops responding.export const CHROME_RAIL_WIDTH = 64;export const CHROME_RAIL_PATH = "/rail";+/** How long a rail the person hid stays hidden for the page's next document to offer its button. */+export const RAIL_OFFER_GRACE_MS = 5_000;+/** Chromium's net::ERR_ABORTED: a load replaced by another, not a page that failed. */+const ABORTED = -3;/*** @param {{@@ -17,12 +25,17 @@ export const CHROME_RAIL_PATH = "/rail";* args: () => string[],* url: () => string,* wanted: () => boolean,+ * prefs?: () => { railHidden(): boolean, setRailHidden(hidden: boolean): void } | null,+ * changed?: () => void,* log?: (line: string) => void,* }} deps `url()`: the rail's page on this app's own server; `wanted()`: whether the window has two places or more to- * show it for (railPlaces); `args()`: the preload's arguments, as the window's own page gets them.+ * show it for (railPlaces); `args()`: the preload's arguments, as the window's own page gets them; `prefs()`: where this+ * desktop keeps the person's choice to hide it; `changed()`: the rail came or went beside the page.*/-export function createChromeRail({ createView, preload, args, url, wanted, log = () => {} }) {+export function createChromeRail({ createView, preload, args, url, wanted, prefs = () => null, changed = () => {}, log = () => {} }) {let view = null, win = null, shown = false, expanded = false;+ // The document beside the rail offered its button; a new one may still (`grace`); the page stopped responding.+ let offered = false, grace = null, hung = false, told = "";const alive = () => Boolean(win && !win.isDestroyed());const layout = () => {if (!view || !shown || !alive()) return;@@ -32,6 +45,31 @@ export function createChromeRail({ createView, preload, args, url, wanted, log =const page = () => (alive() && !win.webContents.isDestroyed() ? win.webContents : null);/** The page beside the rail moves over by its width (0: it has the whole window again). */const tellPage = () => page()?.send("rail:beside", shown ? CHROME_RAIL_WIDTH : 0);+ const choseHidden = () => prefs()?.railHidden() === true;+ /** Hidden by the person's choice, beside a document that can bring it back. */+ const hidden = () => choseHidden() && !hung && (offered || grace !== null);+ const pageState = () => ({ available: alive() && wanted(), hidden: choseHidden() });+ /** The document that offered the button hears when it would change. */+ const tellState = () => {+ const state = pageState(), key = JSON.stringify(state);+ if (!offered || key === told) return;+ told = key;+ page()?.send("rail:state", state);+ };+ const stopGrace = () => { clearTimeout(grace); grace = null; };+ const startGrace = () => {+ stopGrace();+ grace = setTimeout(() => { grace = null; rail.refresh(); }, RAIL_OFFER_GRACE_MS);+ };+ /** The page beside the rail has another document, or lost the one it had. */+ const nextDocument = () => {+ const keep = hidden();+ offered = false; hung = false; told = "";+ if (keep) startGrace(); else stopGrace();+ rail.refresh();+ };+ /** The page beside the rail asks: the window's own page, in its main frame (never a frame inside it). */+ const pageBeside = (event) => Boolean(page() && event?.sender === win.webContents && event.senderFrame === win.webContents.mainFrame);const ensureView = () => {if (view) return view;view = createView({ webPreferences: { contextIsolation: true, sandbox: true, nodeIntegration: false, preload, additionalArguments: args() } });@@ -49,30 +87,44 @@ export function createChromeRail({ createView, preload, args, url, wanted, log =/** The window the rail stands beside: its size moves the rail, and each of its documents gets the room again. */attach(next) {win = next;- shown = false; expanded = false;+ shown = false; expanded = false; offered = false; hung = false; told = "";+ // The window's first document has the same time as any other to offer the button.+ if (choseHidden()) startGrace(); else stopGrace();win.on("resize", layout);+ const contents = win.webContents;// Each new document is told again, once it is ready.- win.webContents.on("dom-ready", () => { if (shown) tellPage(); });+ contents.on("dom-ready", () => { if (shown) tellPage(); });+ contents.on("did-navigate", nextDocument);+ contents.on("render-process-gone", nextDocument);+ // Electron 43 reports an error page that replaced the document here, not as did-navigate.+ contents.on("did-fail-load", (_event, code, _description, _url, mainFrame) => { if (mainFrame && code !== ABORTED) nextDocument(); });+ contents.on("unresponsive", () => { hung = true; rail.refresh(); });+ contents.on("responsive", () => { hung = false; rail.refresh(); });win.once("closed", () => {if (view && !view.webContents.isDestroyed()) view.webContents.close?.({ waitForBeforeUnload: false });- view = null; win = null; shown = false; expanded = false;+ stopGrace();+ view = null; win = null; shown = false; expanded = false; offered = false;});rail.refresh();},- /** Shown while there are two places or more (railPlaces), hidden otherwise: the page then has the whole window. */+ /** Shown while there are two places or more (railPlaces) and the person hasn't hidden it; the page beside it has the+ * whole window otherwise. */refresh() {- const on = alive() && wanted();- if (on === shown) { layout(); return; }- shown = on;- if (on) {- win.contentView.addChildView(ensureView());- layout();- tellPage();- } else {- expanded = false;- if (view) win.contentView.removeChildView(view);+ const on = alive() && wanted() && !hidden();+ if (on === shown) layout();+ else {+ shown = on;+ if (on) {+ win.contentView.addChildView(ensureView());+ layout();+ } else {+ expanded = false;+ if (view) win.contentView.removeChildView(view);+ }tellPage();+ changed();}+ tellState();},/** A sheet of the rail's is open: the view covers the window until it closes. */expand(on) {@@ -87,12 +139,25 @@ export function createChromeRail({ createView, preload, args, url, wanted, log =owns: (event) => Boolean(view && event?.sender === view.webContents && event.senderFrame === view.webContents.mainFrame),shown: () => shown,expanded: () => expanded,- /** The rail's page asks for the whole window while a sheet of its own is open, and gives it back after. */+ /** The rail's page asks for the whole window while a sheet of its own is open, and gives it back after. The page+ * beside it offers the button that hides and shows it; asking is the offer, made again by each document. */install(ipcMain) {ipcMain.handle("rail:expand", (event, on) => {if (!rail.owns(event)) throw new Error("rail:expand is only available to the window's rail");rail.expand(on === true);});+ // Security: the page beside the rail learns only whether there is one to hide, never the places on it.+ const fromPage = (channel, act) => ipcMain.handle(channel, (event, ...values) => {+ if (!pageBeside(event)) throw new Error(`${channel} is only available to the page beside the window's rail`);+ offered = true; stopGrace();+ act(...values);+ const state = pageState();+ told = JSON.stringify(state);+ rail.refresh();+ return state;+ });+ fromPage("rail:offer", () => {});+ fromPage("rail:hide", (hide) => prefs()?.setRailHidden(hide === true));},/** Tells the rail's page something (the places changed, the skin of the page beside it). */send(channel, ...values) {diff --git a/electron/chrome-rail.node-test.mjs b/electron/chrome-rail.node-test.mjsindex 5fd088bbf3..0a0b84a005 100644--- a/electron/chrome-rail.node-test.mjs+++ b/electron/chrome-rail.node-test.mjs@@ -4,17 +4,22 @@ import { readFileSync } from "node:fs";import test from "node:test";import vm from "node:vm";-import { CHROME_RAIL_WIDTH, createChromeRail } from "./chrome-rail.mjs";+import { CHROME_RAIL_PATH, CHROME_RAIL_WIDTH, RAIL_OFFER_GRACE_MS, createChromeRail } from "./chrome-rail.mjs";const RAIL = "http://127.0.0.1:8799/rail";-function world({ wanted = true } = {}) {- const page = Object.assign(new EventEmitter(), { mainFrame: { id: "page-frame" }, told: [], destroyed: false,- send(channel, value) { if (channel === "rail:beside") this.told.push(value); }, isDestroyed() { return this.destroyed; } });+/** The app's window: its page (what it is told, and the rail's state once it asked) and the views laid over it. */+function appWindow() {+ const page = Object.assign(new EventEmitter(), { mainFrame: { id: "page-frame" }, told: [], states: [], destroyed: false,+ send(channel, value) { if (channel === "rail:beside") this.told.push(value); if (channel === "rail:state") this.states.push(value); }, isDestroyed() { return this.destroyed; } });const children = [];const win = Object.assign(new EventEmitter(), { webContents: page, size: [1440, 900], destroyed: false,getContentSize() { return this.size; }, isDestroyed() { return this.destroyed; },contentView: { addChildView: (view) => children.push(view), removeChildView: (view) => children.splice(children.indexOf(view), 1) } });+ return { win, page, children };+}++function viewMaker() {const made = [];const createView = (options) => {const contents = Object.assign(new EventEmitter(), { mainFrame: { id: "rail-frame" }, loaded: [], sent: [], focused: 0, closed: false, opener: null,@@ -24,9 +29,21 @@ function world({ wanted = true } = {}) {made.push(view);return view;};- const state = { wanted };- const rail = createChromeRail({ createView, preload: "/app/preload.cjs", args: () => ["--omb-local-origin=http://127.0.0.1:8799", "--omb-company-desktop=1"], url: () => RAIL, wanted: () => state.wanted });- return { rail, win, page, children, made, state, settle: () => new Promise((resolve) => setImmediate(resolve)) };+ return { made, createView };+}++function world({ wanted = true, hidden = false } = {}) {+ const { win, page, children } = appWindow();+ const { made, createView } = viewMaker();+ const state = { wanted, hidden, changes: 0 };+ const prefs = { railHidden: () => state.hidden, setRailHidden: (value) => { state.hidden = value; } };+ const rail = createChromeRail({ createView, preload: "/app/preload.cjs", args: () => ["--omb-local-origin=http://127.0.0.1:8799", "--omb-company-desktop=1"], url: () => RAIL,+ wanted: () => state.wanted, prefs: () => prefs, changed: () => { state.changes++; } });+ const handlers = new Map();+ rail.install({ handle: (channel, handler) => handlers.set(channel, handler) });+ /** The page beside the rail asks, from its main frame. */+ const ask = (channel, ...values) => handlers.get(channel)({ sender: page, senderFrame: page.mainFrame }, ...values);+ return { rail, win, page, children, made, state, handlers, ask, settle: () => new Promise((resolve) => setImmediate(resolve)) };}test("two places or more: the rail's own page in a view at the window's left edge, and the page beside it moves over", async () => {@@ -50,8 +67,7 @@ test("two places or more: the rail's own page in a view at the window's left edgtest("a sheet of the rail's covers the whole window until it closes; only the rail's page may ask", async () => {const w = world();- const handlers = new Map();- w.rail.install({ handle: (channel, handler) => handlers.set(channel, handler) });+ const handlers = w.handlers;w.rail.attach(w.win);const [view] = w.made;const fromRail = { sender: view.webContents, senderFrame: view.webContents.mainFrame };@@ -107,30 +123,127 @@ test("nothing to show: no view is made at all", () => {assert.deepEqual([w.made.length, w.children.length, w.page.told.length], [0, 0, 0]);});+test("the page beside the rail offers the button: hiding gives the page the whole window, and this desktop keeps the choice", () => {+ const w = world();+ w.rail.attach(w.win);+ const [view] = w.made;+ assert.deepEqual(w.ask("rail:offer"), { available: true, hidden: false }, "whether there is a rail to hide, never its places");+ assert.deepEqual(w.ask("rail:hide", true), { available: true, hidden: true });+ assert.equal(w.state.hidden, true, "kept with this desktop's own preferences");+ assert.deepEqual([w.children, w.page.told.at(-1), w.rail.shown(), w.state.changes], [[], 0, false, 2], "the page has the whole window, and pages hear the rail went");+ assert.deepEqual(w.ask("rail:hide", "yes"), { available: true, hidden: false }, "only true hides it");+ assert.deepEqual([w.children, w.page.told.at(-1), w.made.length], [[view], CHROME_RAIL_WIDTH, 1], "the same page comes back beside it");+ w.ask("rail:hide", true);+ w.state.wanted = false;+ w.rail.refresh();+ assert.deepEqual(w.page.states, [{ available: false, hidden: true }], "told when there is no rail to show any more, and never what it was just answered");+});++test("only the page beside the rail, in its main frame, offers the button: never the rail's own page, a frame inside the page or another window", () => {+ const w = world();+ w.rail.attach(w.win);+ const [view] = w.made, other = appWindow().page;+ for (const event of [{ sender: view.webContents, senderFrame: view.webContents.mainFrame }, { sender: w.page, senderFrame: { id: "an-iframe" } },+ { sender: other, senderFrame: other.mainFrame }, {}]) {+ assert.throws(() => w.handlers.get("rail:offer")(event), /only available to the page beside the window's rail/);+ assert.throws(() => w.handlers.get("rail:hide")(event, true), /only available to the page beside the window's rail/);+ }+ assert.deepEqual([w.state.hidden, w.rail.shown()], [false, true], "nothing hidden, nothing kept");+});++test("after the page moves on, a hidden rail waits a few seconds for the new page's button: this app's page keeps it hidden, an older one gets it back", (t) => {+ t.mock.timers.enable({ apis: ["setTimeout"] });+ const w = world({ hidden: true });+ w.rail.attach(w.win);+ assert.deepEqual([w.rail.shown(), w.made.length], [false, 0], "hidden while the window's first page loads");+ w.page.emit("did-navigate");+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS - 1);+ w.ask("rail:offer");+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS);+ assert.deepEqual([w.rail.shown(), w.made.length, w.page.told], [false, 0, []], "the page offered its button in time: no flicker");+ w.page.emit("did-navigate");+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS - 1);+ assert.equal(w.rail.shown(), false, "still time for the next page");+ t.mock.timers.tick(1);+ assert.deepEqual([w.rail.shown(), w.page.told.at(-1)], [true, CHROME_RAIL_WIDTH], "an older server's page with no button: the rail comes back");+ assert.equal(w.state.hidden, true, "and the choice is kept");+ w.page.emit("did-navigate");+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS);+ assert.equal(w.rail.shown(), true, "a rail back beside a page with no button stays while the next one loads");+ w.ask("rail:offer");+ assert.deepEqual([w.rail.shown(), w.page.told.at(-1)], [false, 0], "until that one offers its button");+});++test("a page that stops responding, crashes or gives way to an error page gets the rail back", (t) => {+ t.mock.timers.enable({ apis: ["setTimeout"] });+ const w = world({ hidden: true });+ w.rail.attach(w.win);+ w.ask("rail:offer");+ w.page.emit("unresponsive");+ assert.equal(w.rail.shown(), true, "a hung page can't bring it back");+ w.page.emit("responsive");+ assert.equal(w.rail.shown(), false, "hidden again once it answers");+ w.page.emit("render-process-gone");+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS);+ assert.equal(w.rail.shown(), true, "its page crashed, and nothing offered the button since");+ w.ask("rail:offer");+ w.page.emit("did-fail-load", {}, -3, "ERR_ABORTED", "https://cloud.example.test/", true);+ w.page.emit("did-fail-load", {}, -105, "ERR_NAME_NOT_RESOLVED", "https://cdn.example.test/", false);+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS);+ assert.equal(w.rail.shown(), false, "a load cut short by another, or a frame inside the page that failed, leaves the page as it was");+ w.page.emit("did-fail-load", {}, -105, "ERR_NAME_NOT_RESOLVED", "https://cloud.example.test/", true);+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS);+ assert.equal(w.rail.shown(), true, "an error page in its place has no button");+ w.win.emit("closed");+ t.mock.timers.tick(RAIL_OFFER_GRACE_MS);+});++test("main's own wiring: the choice is this desktop's, and the pages hear the rail come and go", () => {+ const main = readFileSync(new URL("./main.mjs", import.meta.url), "utf8").replace(/\r\n/g, "\n");+ const start = main.indexOf("const chromeRail = createChromeRail("), end = main.indexOf("chromeRail.install(ipcMain);", start);+ assert.ok(start >= 0 && end > start, "main makes the window's rail");+ const { made, createView } = viewMaker();+ const kept = { hidden: false }, signals = [], handlers = new Map();+ const context = vm.createContext({ createChromeRail, CHROME_RAIL_PATH, WebContentsView: function WebContentsView(options) { return createView(options); },+ path: { join: (...parts) => parts.join("/") }, __dirname: "/app", slog: () => {}, desktopCompanionRendererArguments: () => [],+ app: { isPackaged: true, getVersion: () => "0.1.133" }, desktopRemoteAccess: null, rendererOrigin: () => "http://127.0.0.1:8799", serverReady: true,+ railList: () => [{ id: "local" }, { id: "home" }], desktopPrefs: { railHidden: () => kept.hidden, setRailHidden: (hidden) => { kept.hidden = hidden; } },+ rail: { changed: () => signals.push("changed") }, ipcMain: { handle: (channel, handler) => handlers.set(channel, handler) } });+ const chromeRail = vm.runInContext(`${main.slice(start, end)}chromeRail.install(ipcMain); chromeRail`, context);+ const { win, page } = appWindow();+ chromeRail.attach(win);+ assert.deepEqual(made.map((view) => view.webContents.loaded), [["http://127.0.0.1:8799/rail"]]);+ handlers.get("rail:hide")({ sender: page, senderFrame: page.mainFrame }, true);+ assert.deepEqual([kept.hidden, chromeRail.shown(), signals], [true, false, ["changed", "changed"]]);+});+/** The app's preload in a page of the window, with what the room needs of the page: its document, size and zoom. */-function pageWithPreload(origin = "https://bots.example.test", pathname = "/") {- const listeners = new Map(), handlers = new Map();+function pageWithPreload(origin = "https://bots.example.test", pathname = "/", answer = () => undefined) {+ const listeners = new Map(), handlers = new Map(), invoked = [];const head = { children: [], append(node) { this.children.push(node); node.isConnected = true; } };const document = { documentElement: { style: { zoom: "" } }, head, createElement: () => ({ textContent: "", isConnected: false, remove() { head.children.splice(head.children.indexOf(this), 1); this.isConnected = false; } }) };- const frame = { zoom: 1 };+ const frame = { zoom: 1 }, navigator = { userActivation: { isActive: false } };+ let bridge = null;vm.runInNewContext(readFileSync(new URL("./preload.cjs", import.meta.url), "utf8"), {process: { platform: "darwin", argv: ["--omb-local-origin=http://127.0.0.1:8799", "--omb-company-desktop=1"] },- location: { origin, pathname }, navigator: { userActivation: { isActive: false } }, TextEncoder, localStorage: { getItem: () => null }, queueMicrotask, document,+ location: { origin, pathname }, navigator, TextEncoder, localStorage: { getItem: () => null }, queueMicrotask, document,window: { addEventListener: (type, listener) => listeners.set(type, listener) },- require: () => ({ webUtils: {}, webFrame: { getZoomFactor: () => frame.zoom }, contextBridge: { exposeInMainWorld() {} },- ipcRenderer: { on: (channel, handler) => handlers.set(channel, handler), removeListener() {}, send() {}, sendSync: () => null, invoke: () => Promise.resolve() } }),+ require: () => ({ webUtils: {}, webFrame: { getZoomFactor: () => frame.zoom }, contextBridge: { exposeInMainWorld: (_name, value) => { bridge = value; } },+ ipcRenderer: { on: (channel, handler) => handlers.set(channel, handler), removeListener: (channel, handler) => { if (handlers.get(channel) === handler) handlers.delete(channel); },+ send() {}, sendSync: () => null, invoke: (channel, ...values) => { invoked.push([channel, ...values]); return Promise.resolve(answer(channel, ...values)); } } }),});- return { head, frame, root: document.documentElement, tell: (width) => handlers.get("rail:beside")({}, width), resize: () => listeners.get("resize")() };+ return { head, frame, root: document.documentElement, bridge, invoked, navigator, tell: (width) => handlers.get("rail:beside")({}, width), resize: () => listeners.get("resize")(),+ hear: (channel, ...values) => handlers.get(channel)?.({}, ...values) };}test("every page beside the rail, from any server, moves over by the rail's width at any zoom, and back when it goes", () => {const page = pageWithPreload();page.tell(CHROME_RAIL_WIDTH);assert.equal(page.head.children.length, 1);- assert.match(page.head.children[0].textContent, /padding-left: 64px !important/);+ assert.match(page.head.children[0].textContent, /padding-left: 64px !important; --rail-beside: 64px;/, "and the page can read how far it moved");page.frame.zoom = 1.25;page.resize();- assert.match(page.head.children[0].textContent, /padding-left: 51\.2px !important/, "zoomed in, the same 64 points on screen");+ assert.match(page.head.children[0].textContent, /padding-left: 51\.2px !important; --rail-beside: 51\.2px;/, "zoomed in, the same 64 points on screen");page.tell("9999");assert.match(page.head.children[0].textContent, /padding-left: 160px/, "never more than 200 points, whatever is sent");page.tell(0);@@ -152,3 +265,25 @@ test("the rail's own page keeps its size at any zoom of this app's page (Chromiuassert.equal(page.root.style.zoom, "", `${origin}${pathname} keeps its zoom`);}});++test("every page beside the rail, from any server, gets the button's bridge and learns only whether there is a rail to hide; the rail's own channels stay this app's", async () => {+ const remote = pageWithPreload("https://bots.example.test", "/", (channel) => (channel === "rail:offer" ? { available: "yes", hidden: 1, places: [{ id: "home" }] } : { available: true, hidden: true }));+ assert.deepEqual(Object.keys(remote.bridge.rail), ["state", "setHidden", "onState"]);+ /** A value made in the page's own context, as this one sees it. */+ const plain = (value) => JSON.parse(JSON.stringify(value));+ assert.deepEqual(plain(await remote.bridge.rail.state()), { available: false, hidden: false }, "two plain answers, nothing else main might send");+ await assert.rejects(remote.bridge.rail.setHidden(true), /Choose to hide or show/, "a server's page hides it only from the person's click");+ remote.navigator.userActivation.isActive = true;+ assert.deepEqual(plain(await remote.bridge.rail.setHidden(true)), { available: true, hidden: true });+ assert.deepEqual(plain(remote.invoked), [["rail:offer"], ["rail:hide", true]]);+ const heard = [];+ const stop = remote.bridge.rail.onState((state) => heard.push(state));+ remote.hear("rail:state", { available: true, hidden: false, places: ["home"] });+ stop();+ remote.hear("rail:state", { available: true, hidden: true });+ assert.deepEqual(plain(heard), [{ available: true, hidden: false }]);+ const local = pageWithPreload("http://127.0.0.1:8799", "/");+ assert.deepEqual(Object.keys(local.bridge.rail), ["state", "setHidden", "onState", "expand", "onSkin"]);+ await local.bridge.rail.setHidden(false);+ assert.deepEqual(plain(local.invoked), [["rail:hide", false]], "this app's own page, as for its other choices");+});diff --git a/electron/cloud-rail.mjs b/electron/cloud-rail.mjsindex ca493c2fd5..d315d53391 100644--- a/electron/cloud-rail.mjs+++ b/electron/cloud-rail.mjs@@ -191,9 +191,10 @@ export function installCloudRail({ ipcMain, guard, trusted, lists = trusted, bes});return {sheetOpen: () => sheetOpen,- /** The places or the sign-in changed: the page that shows the rail reads it again (a signal only, never the list). */+ /** The places, the sign-in or the rail beside the page changed: the rail's page and the page beside it read them+ * again (a signal only, never the list). */changed() {- const key = JSON.stringify([places(), choices(), account()?.state().adding ?? null, account()?.state().addCloud ?? null]);+ const key = JSON.stringify([places(), choices(), account()?.state().adding ?? null, account()?.state().addCloud ?? null, beside()]);if (key === sent) return;sent = key;for (const target of targets()) if (target && !target.isDestroyed()) target.send("workspaces:changed");diff --git a/electron/cloud-rail.node-test.mjs b/electron/cloud-rail.node-test.mjsindex 0a029b8eeb..865b73fa42 100644--- a/electron/cloud-rail.node-test.mjs+++ b/electron/cloud-rail.node-test.mjs@@ -143,6 +143,9 @@ test("the rail's channels: the list only for the rail's own page, a circle onlyassert.deepEqual([r.opened, r.ran], [["a"], ["link"]]);r.installed.changed(); r.installed.changed();assert.deepEqual(r.sent, ["page:workspaces:changed", "rail:workspaces:changed"], "a signal only, to the page and the rail, and once per change");+ r.w.beside = true;+ r.installed.changed();+ assert.deepEqual(r.sent.slice(2), ["page:workspaces:changed", "rail:workspaces:changed"], "the rail came beside the page (or went): the page reads it again");});test("buying another Cloud from a page: the plan must be on sale, the name is checked, and the page gets only what the sheet says", async () => {diff --git a/electron/desktop-prefs.d.mts b/electron/desktop-prefs.d.mtsindex 7d3711cc68..8c2fdb6df7 100644--- a/electron/desktop-prefs.d.mts+++ b/electron/desktop-prefs.d.mts@@ -52,6 +52,9 @@ export interface DesktopPrefs {/** The Quick asks chat made on this server (keyed by its data folder), null until one is saved. */quickAsksChat(server: string): { botId: string; threadId: string } | null;setQuickAsksChat(server: string, chat: { botId: string; threadId: string }): void;+ /** False until the person hides the window's rail of places. */+ railHidden(): boolean;+ setRailHidden(hidden: boolean): void;}type Files = Pick<typeof import("node:fs"), "readFileSync" | "writeFileSync" | "renameSync" | "rmSync">;export declare function jsonFile(file: string, files?: Files): { read(): unknown; write(value: unknown): void };diff --git a/electron/desktop-prefs.mjs b/electron/desktop-prefs.mjsindex 33c1752cb1..98f55553e7 100644--- a/electron/desktop-prefs.mjs+++ b/electron/desktop-prefs.mjs@@ -1,5 +1,6 @@// What this desktop keeps whatever page its window shows, whichever port its own page is served on: the notices it-// has shown, its usage-analytics switch, the app's language and its answer to the product-updates email question.+// has shown, its usage-analytics switch, the app's language, its answer to the product-updates email question and+// whether the person hid the window's rail of places.import { randomBytes } from "node:crypto";import fs from "node:fs";import { localDay } from "./cloud-trial-notice.mjs";@@ -57,6 +58,7 @@ function parse(raw) {...(updatesConsent ? { updatesConsent } : {}),...(typeof record.talkShortcut === "boolean" ? { talkShortcut: record.talkShortcut } : {}),...(isTalkKey(record.talkKey) ? { talkKey: record.talkKey } : {}),+ ...(typeof record.railHidden === "boolean" ? { railHidden: record.railHidden } : {}),...(Object.keys(quickAsks).length ? { quickAsks } : {}) };}@@ -124,6 +126,12 @@ export function createDesktopPrefs({ read, write, now = Date.now }) {const parsed = typeof server === "string" ? parseChat(chat) : null;if (parsed) save({ ...current(), quickAsks: { ...current().quickAsks, [server]: parsed } });},+ /** The window's rail of places is shown until the person hides it. */+ railHidden: () => current().railHidden === true,+ setRailHidden(hidden) {+ const railHidden = hidden === true;+ if ((current().railHidden === true) !== railHidden) save({ ...current(), railHidden });+ },};}diff --git a/electron/desktop-prefs.node-test.mjs b/electron/desktop-prefs.node-test.mjsindex 4af191a303..b19f2cf38b 100644--- a/electron/desktop-prefs.node-test.mjs+++ b/electron/desktop-prefs.node-test.mjs@@ -269,7 +269,7 @@ test("production wiring: main answers this computer's page, My Cloud's own pageconst main = readFileSync(new URL("./main.mjs", import.meta.url), "utf8").replace(/\r\n/g, "\n");assert.match(main, /for \(const port of DESKTOP_PORTS\)/, "main tries the ports this module names, in order");assert.deepEqual([...DESKTOP_PORTS], [8799, 18799, 28799]);- const start = main.indexOf(" const desktopPrefs = createDesktopPrefs("), end = main.indexOf("\n", main.indexOf("page:", start));+ const start = main.indexOf(" desktopPrefs = createDesktopPrefs("), end = main.indexOf("\n", main.indexOf("page:", start));assert.ok(start >= 0 && end > start, "main.mjs registers the desktop prefs");let options = null;const localFrame = { url: `${LOCAL}/` }, serverFrame = { url: `${VPS}/` };@@ -312,6 +312,19 @@ test("production wiring: main answers this computer's page, My Cloud's own pageassert.equal(await vm.runInNewContext(`${navigate}; navigateMainWindow`, { mainWindow: null })(`${LOCAL}/`), false, "no window");});+test("the window's rail of places is shown until the person hides it, and the choice survives a restart", () => {+ let saved = null, writes = 0;+ const prefs = createDesktopPrefs({ read: () => saved, write: value => { saved = structuredClone(value); writes++; } });+ assert.equal(prefs.railHidden(), false);+ prefs.setRailHidden(false);+ assert.equal(writes, 0, "showing a rail that shows writes nothing");+ prefs.setRailHidden(true);+ assert.equal(createDesktopPrefs({ read: () => saved, write: () => {} }).railHidden(), true);+ prefs.setRailHidden("no");+ assert.equal(createDesktopPrefs({ read: () => saved, write: () => {} }).railHidden(), false, "only true hides it");+ assert.equal(createDesktopPrefs({ read: () => ({ railHidden: "yes" }), write: () => {} }).railHidden(), false);+});+test("the talk shortcut is on with ⌃⌥Space until changed, and the choice survives a restart", () => {let saved = null;const prefs = createDesktopPrefs({ read: () => saved, write: value => { saved = structuredClone(value); } });diff --git a/electron/main.mjs b/electron/main.mjsindex b376ac7145..5d1a9cca39 100644--- a/electron/main.mjs+++ b/electron/main.mjs@@ -269,7 +269,7 @@ let desktopDataDirLease = null;let runningDataDir = null;let localSwitchInFlight = false;let managedDesktop = null;-let cloudAccount = null, updatesConsent = null;+let cloudAccount = null, updatesConsent = null, desktopPrefs = null;let cloudAccountStarted = Promise.resolve();let cloudAccountRestoring = false;let cloudSignInRestored = false;@@ -2690,7 +2690,7 @@ const openOwnCloud = id => showHome({ place: { cloud: id, name: environmentsStat// The rail and its + (cloud-rail.mjs): its list for this app's page and hosted Clouds' pages only, opened through switchEnvironment.const railList = () => railPlaces({ saved: environmentsState, home: homeWindow.cloudOrigin(), mine: myCloud(), state: desktopRemoteAccess ? null : cloudAccount?.state() });// The rail as the window's own chrome (chrome-rail.mjs): this app's page beside every place's page, the one that lists.-const chromeRail = createChromeRail({ createView: options => new WebContentsView(options), preload: path.join(__dirname, "preload.cjs"), log: slog,+const chromeRail = createChromeRail({ createView: options => new WebContentsView(options), preload: path.join(__dirname, "preload.cjs"), log: slog, prefs: () => desktopPrefs, changed: () => rail.changed(),args: () => [...desktopCompanionRendererArguments(rendererOrigin(), desktopRemoteAccess), ...(app.isPackaged && !desktopRemoteAccess ? ["--omb-company-desktop=1"] : []), `--omb-app-version=${app.getVersion()}`],url: () => `${rendererOrigin()}${CHROME_RAIL_PATH}`, wanted: () => !desktopRemoteAccess && serverReady && railList().length > 0 });chromeRail.install(ipcMain);@@ -3030,7 +3030,7 @@ app.whenReady().then(async () => {registerCuaIpc();androidDevice.registerIpc(ipcMain);registerUpdaterIpc({ pageAllowed: updaterPageAllowed });- const desktopPrefs = createDesktopPrefs(jsonFile(path.join(app.getPath("userData"), "desktop-prefs.json")));+ desktopPrefs = createDesktopPrefs(jsonFile(path.join(app.getPath("userData"), "desktop-prefs.json")));updatesConsent = registerDesktopPrefs({ ipcMain, cloudAccount: () => cloudAccount, prefs: desktopPrefs, localConfig: jsonFile(path.join(desktopDataDir(), "config.json")).read, cloudOffered: () => cloudAccountRestored().then(cloudOffersReady),languageChanged: (language, sender) => {for (const win of appWindows()) if (!win.isDestroyed() && win.webContents !== sender) win.webContents.send("desktop-language:changed", language);diff --git a/electron/preload.cjs b/electron/preload.cjsindex 397602af2b..6122f49be5 100644--- a/electron/preload.cjs+++ b/electron/preload.cjs@@ -40,16 +40,19 @@ const localOrigin = process.argv.find((arg) => arg.startsWith("--omb-local-origiconst isLocalPage = !localOrigin || location.origin === localOrigin;// The window's own rail of places stands at its left edge (electron/chrome-rail.mjs): main says how wide, and every page-// beside it, whatever server it comes from, moves over by that much, at any zoom (a zoom change resizes the page).+// beside it, whatever server it comes from, moves over by that much, at any zoom (a zoom change resizes the page). The+// page reads how far in `--rail-beside`, which changes with the move itself.let railBeside = 0, railRoom = null;function leaveRailRoom() {if (typeof document === "undefined" || !document.documentElement) return;const zoom = Number(webFrame?.getZoomFactor?.()) || 1;if (!railBeside) { railRoom?.remove(); railRoom = null; return; }railRoom ??= document.createElement("style");- railRoom.textContent = `html { box-sizing: border-box !important; padding-left: ${Math.round((railBeside / zoom) * 100) / 100}px !important; }`;+ const room = `${Math.round((railBeside / zoom) * 100) / 100}px`;+ railRoom.textContent = `html { box-sizing: border-box !important; padding-left: ${room} !important; --rail-beside: ${room}; }`;if (!railRoom.isConnected) (document.head ?? document.documentElement).append(railRoom);}+const railState = (state) => ({ available: state?.available === true, hidden: state?.hidden === true });ipcRenderer.on("rail:beside", (_event, width) => { railBeside = Math.max(0, Math.min(200, Number(width) || 0)); leaveRailRoom(); });// The rail's own page keeps its size whatever the zoom of this app's page: Chromium gives every page of a host the same// zoom, the rail's included, so the rail takes it back out and stays as wide as its strip.@@ -61,7 +64,7 @@ function railKeepsItsSize() {if (typeof window !== "undefined") {for (const type of ["resize", "DOMContentLoaded"]) window.addEventListener(type, () => { leaveRailRoom(); railKeepsItsSize(); });}-const REMOTE_SAFE = new Set(["platform", "app", "getCapabilities", "onCapabilitiesChanged", "applySkin", "setUnreadCount", "permStatus", "workspaces", "cloudAdd", "cloudPlan", "cloudSendPage", "desktopNotices", "desktopAnalytics", "desktopLanguage", "updatesConsent", "windowControls"]);+const REMOTE_SAFE = new Set(["platform", "app", "getCapabilities", "onCapabilitiesChanged", "applySkin", "setUnreadCount", "permStatus", "workspaces", "rail", "cloudAdd", "cloudPlan", "cloudSendPage", "desktopNotices", "desktopAnalytics", "desktopLanguage", "updatesConsent", "windowControls"]);/** My Cloud's own page once it is the person's home (main checks the sender again): it is this app's page then. */const HOME_PAGE = ["home", "onChatLink", "onPackageInstall", "onOpenAppSettings", "exportDiagnostics", "openLogsFolder", "openAtLogin", "callActive"];function updaterOffered() {@@ -149,14 +152,25 @@ const bridge = {},},// The window's own rail (this app's page at /rail, beside every place's page): while a sheet of its own is open it- // covers the window; the skin of the page beside it comes from main.+ // covers the window; the skin of the page beside it comes from main. The page beside it, from whichever server,+ // offers the button that hides and shows it, and learns only whether there is one to hide, never its places.rail: {- expand: (on) => ipcRenderer.invoke("rail:expand", on === true),- onSkin: (cb) => {- const handler = (_event, skin) => cb(String(skin));- ipcRenderer.on("rail:skin", handler);- return () => ipcRenderer.removeListener("rail:skin", handler);+ state: () => ipcRenderer.invoke("rail:offer").then(railState),+ setHidden: (hidden) => isLocalPage || navigator.userActivation?.isActive === true+ ? ipcRenderer.invoke("rail:hide", hidden === true).then(railState) : Promise.reject(new Error("Choose to hide or show your computers.")),+ onState: (cb) => {+ const handler = (_event, state) => cb(railState(state));+ ipcRenderer.on("rail:state", handler);+ return () => ipcRenderer.removeListener("rail:state", handler);},+ ...(isLocalPage ? {+ expand: (on) => ipcRenderer.invoke("rail:expand", on === true),+ onSkin: (cb) => {+ const handler = (_event, skin) => cb(String(skin));+ ipcRenderer.on("rail:skin", handler);+ return () => ipcRenderer.removeListener("rail:skin", handler);+ },+ } : {}),},// Buying another Cloud from the rail's +, on this app's page or a hosted Cloud's: plain words in, what the sheet says// out; the account, the token and the checkout page stay in main. Only from the person's click where it opens anything.diff --git a/scripts/testing/rail-preview.tsx b/scripts/testing/rail-preview.tsxindex b742dfe813..0897a3321f 100644--- a/scripts/testing/rail-preview.tsx+++ b/scripts/testing/rail-preview.tsx@@ -5,6 +5,7 @@ import type { PlaceLook } from "../../electron/place-look.mjs";import App from "../../src/App";import { setAnalyticsEnabled, setEmailGateDone } from "../../src/lib/analytics";import { setAdvancedMode } from "../../src/lib/interface-mode";+import { setSidebarDensity } from "../../src/lib/sidebar-preferences";import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";import { applySkin, type SkinId } from "../../src/lib/skins";import "../../src/styles.css";@@ -16,12 +17,17 @@ import "../../src/styles.css";// person's own servers that signed in. ?look=<colour>|none is the place's colour (its tint), ?member a team's Cloud// its member is on, ?settings=look Settings → Appearance at the place's colour, ?menu=<id> that circle's own menu (a// right-click: its colour). ?place=computer is this computer's own page instead, on a desktop with no Cloud: no rail,-// or with ?rail one beside it (this computer and a server connected by hand).+// or with ?rail one beside it (this computer and a server connected by hand). ?density=icons collapses the sidebar to+// avatars; ?settings=general opens Settings at its first page, ?settings=strip at the switch for the window's rail.+// ?hidden starts with the rail hidden (the sidebar's button shows it again). The rail is drawn on the page itself, as an+// older app's page draws it; ?chrome stands in for the window's own rail instead: the room the app's preload leaves+// for it, with nothing drawn there, so the page lays out as it does beside the real one.const params = new URLSearchParams(location.search);setAnalyticsEnabled(false);setEmailGateDone("skipped");markSimpleModePromptSeen();setAdvancedMode(params.get("mode") !== "simple");+setSidebarDensity(params.get("density") === "icons" ? "icons" : "comfortable");applySkin((params.get("skin") ?? "midnight") as SkinId);const place = (id: string, name: string, extra: Partial<RailPlace> = {}): RailPlace => ({ id, name, color: null, kind: "cloud", opens: true, ...extra });@@ -69,6 +75,14 @@ const adding = params.get("adding") === "setting_up"? { adding: { name: "Client C", color: "rose" as const, tier: "pro", startedAt: Date.now(), status: "setting_up" as const, progress: 0.55, link: true as const } } : {};const addView: AddCloudView = { signedIn: true, hasCloud: true, supported: true, canAdd: true, offer, count: 3, home: { name: "My Cloud", color: "blue" }, ...adding };const ok = async () => {};+const chrome = params.has("chrome");+let hidden = params.has("hidden");+const placesHeard = new Set<() => void>(), stripHeard = new Set<(state: { available: boolean; hidden: boolean }) => void>();+const strip = () => ({ available: listed.length > 1, hidden });+const room = document.createElement("style");+room.textContent = "html { box-sizing: border-box !important; padding-left: 64px !important; --rail-beside: 64px; }";+const besidePage = () => { if (chrome && !hidden) document.head.append(room); else room.remove(); };+besidePage();Object.assign(window, { ogb: {platform: "darwin",app: { version: "0.1.130", ownPage: computer },@@ -80,7 +94,9 @@ Object.assign(window, { ogb: {applySkin: ok, setUnreadCount: () => {}, permStatus: async () => ({}),workspaces: {state: async () => (computer ? { local: true, name: "This computer" } : { local: false, name: "My Cloud", origin: "https://omb-u-1.fly.dev", color: "blue" }),- menu: ok, line: async () => null, places: async () => rail, open: ok, add: ok, onChanged: () => () => {},+ menu: ok, line: async () => null, open: ok, add: ok,+ places: async () => (hidden ? { ...rail, places: [] } : chrome ? { ...rail, places: [], beside: true as const } : rail),+ onChanged: (heard: () => void) => { placesHeard.add(heard); return () => { placesHeard.delete(heard); }; },look: async () => look,recolor: async (id: string, swatch: CloudSwatch) => {rail.places = rail.places.map((entry) => (entry.id === id ? { ...entry, color: COLOR[swatch], paint: { swatch: COLOR[swatch] ? swatch : null } } : entry));@@ -89,6 +105,17 @@ Object.assign(window, { ogb: {color: async (swatch: CloudSwatch) => { look = { ...look, swatch: COLOR[swatch] ? swatch : null, color: COLOR[swatch] }; return { outcome: "saved", look }; },},cloudAdd: { state: async () => addView, start: async () => ({ outcome: "opened" }), reopen: async () => true, copyLink: async () => true, open: ok, interest: ok, sheet: ok },+ rail: {+ state: async () => strip(),+ setHidden: async (next: boolean) => {+ hidden = next;+ besidePage();+ for (const heard of placesHeard) heard();+ for (const heard of stripHeard) heard(strip());+ return strip();+ },+ onState: (heard: (state: { available: boolean; hidden: boolean }) => void) => { stripHeard.add(heard); return () => { stripHeard.delete(heard); }; },+ },} });if (member) {@@ -120,23 +147,18 @@ const sheet = params.get("sheet");if (sheet === "connect") void click('[data-rail-place="signed-in:s-render"]');else if (sheet) void click("[data-rail-add]").then(() => (sheet === "server" ? click('[data-place-add-choice="server"]') : sheet === "add" ? undefined : click('[data-place-add-choice="cloud"]'))).then(() => (sheet === "name" ? click("[data-plan-buy='pro']") : undefined));-/** A Settings row's own button, by the row's title (Simple mode's pages name no section). */-const clickRow = (title: string) => new Promise<void>((resolve) => {- const tick = () => {- const row = [...document.querySelectorAll<HTMLElement>("[role='group'][aria-labelledby]")]- .find((group) => document.getElementById(group.getAttribute("aria-labelledby") ?? "")?.textContent === title);- const button = row?.querySelector<HTMLElement>("button");- if (button) { button.click(); resolve(); } else setTimeout(tick, 100);- };- tick();-});-if (params.get("settings") === "look") {- const opened = () => new Promise<void>((resolve) => { const tick = () => { if (openSettings) { openSettings(); resolve(); } else setTimeout(tick, 100); }; tick(); });- void opened().then(() => (params.get("mode") === "simple" ? clickRow("More looks") : click('[data-settings-section="appearance"]')))+const openedSettings = () => new Promise<void>((resolve) => { const tick = () => { if (openSettings) { openSettings(); resolve(); } else setTimeout(tick, 100); }; tick(); });+const settings = params.get("settings");+if (settings) {+ // Simple mode's General page has the sidebar's rows and the rail's switch; Advanced keeps them in Appearance.+ void openedSettings().then(() => (params.get("mode") === "simple" || settings === "general" ? undefined : click('[data-settings-section="appearance"]'))).then(() => new Promise<void>((resolve) => setTimeout(resolve, 300))).then(() => {+ if (settings === "general") return document.querySelector("[data-settings-block='appearance']")?.scrollIntoView({ block: "start" });+ // The rail's switch closes the picture, with the sidebar's own rows above it.+ if (settings === "strip") return document.querySelector("[data-rail-switch]")?.scrollIntoView({ block: "end" });const shown = document.querySelector("[data-place-look], [data-place-picture]");- (shown?.closest("[data-sidebar-look], .rounded-xl") ?? shown)?.scrollIntoView({ block: "center" });+ (shown?.closest("[data-sidebar-look]") ?? shown)?.scrollIntoView({ block: "center" });});}if (params.has("more")) void click("[data-rail-more-button]");diff --git a/scripts/verify-cloud-rail.ts b/scripts/verify-cloud-rail.tsindex ef08dd0199..1adb79ce16 100644--- a/scripts/verify-cloud-rail.ts+++ b/scripts/verify-cloud-rail.ts@@ -3,7 +3,8 @@// Run: node --experimental-strip-types scripts/verify-cloud-rail.ts [--shots <dir> [--only <view,view>] [--size <width>x<height>]]// With --shots it photographs each view in a light and a dark skin with a headless Chrome in a throwaway profile// (OMB_CDP_CHROME, else the installed Google Chrome) at twice the window's size (1280x800 unless --size says) and-// exits; without, it prints the preview's address and waits.+// exits; without, it prints the preview's address and waits. With --shots it also checks that the sidebar's button for+// the window's rail lands on the same spot with the rail shown and hidden, and fails if it doesn't.import { spawn } from "node:child_process";import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";@@ -22,10 +23,23 @@ const size = /^(\d{3,4})x(\d{3,4})$/.exec(sizeAt === -1 ? "1280x800" : process.aif (!size) throw new Error("--size takes the window's width and height, such as 1338x870");const [WIDTH, HEIGHT] = [Number(size[1]), Number(size[2])];const CHROME = process.env.OMB_CDP_CHROME ?? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";-/** Each view: its query, what must be on screen before the picture, and the window's height. */-const VIEWS: Array<{ name: string; query: string; ready: string; height?: number; banner?: true }> = [- { name: "rail", query: "", ready: "[data-places-rail]" },- { name: "rail-simple", query: "mode=simple", ready: "[data-places-rail]" },+const RAIL_AND_BUTTON = "body:has([data-places-rail]) [data-rail-toggle]";+/** Each view: its query, what must be on screen before the picture, and the window's height. Views that name the same+ * `button` spot must have the rail's button at the same place. */+const VIEWS: Array<{ name: string; query: string; ready: string; height?: number; banner?: true; button?: string }> = [+ { name: "rail", query: "", ready: RAIL_AND_BUTTON, button: "advanced" },+ { name: "rail-simple", query: "mode=simple", ready: RAIL_AND_BUTTON, button: "simple" },+ { name: "rail-hidden", query: "hidden=1", ready: "[data-rail-toggle][aria-expanded='false']", button: "advanced" },+ { name: "rail-hidden-simple", query: "mode=simple&hidden=1", ready: "[data-rail-toggle][aria-expanded='false']", button: "simple" },+ { name: "rail-icons", query: "density=icons", ready: RAIL_AND_BUTTON },+ { name: "rail-icons-simple", query: "mode=simple&density=icons", ready: RAIL_AND_BUTTON },+ { name: "rail-chrome", query: "chrome=1", ready: "[data-rail-toggle]", button: "advanced" },+ { name: "rail-chrome-simple", query: "mode=simple&chrome=1", ready: "[data-rail-toggle]", button: "simple" },+ { name: "rail-chrome-hidden", query: "chrome=1&hidden=1", ready: "[data-rail-toggle][aria-expanded='false']", button: "advanced" },+ { name: "rail-chrome-hidden-simple", query: "mode=simple&chrome=1&hidden=1", ready: "[data-rail-toggle][aria-expanded='false']", button: "simple" },+ { name: "general-settings-simple", query: "mode=simple&settings=general", ready: "[data-settings-block='appearance']" },+ { name: "strip-settings", query: "settings=strip", ready: "[data-rail-switch]" },+ { name: "strip-settings-simple", query: "mode=simple&settings=strip", ready: "[data-rail-switch]" },{ name: "rail-many", query: "places=many&more=1", ready: "[data-rail-more] li" },{ name: "add-sheet", query: "sheet=add", ready: "[data-place-add='choose']" },{ name: "add-own-server", query: "sheet=server", ready: "[data-place-add='own-server']" },@@ -91,7 +105,8 @@ async function openChrome(profile: string) {});const evaluate = async (expression: string) => (await send("Runtime.evaluate", { expression, returnByValue: true, awaitPromise: true })).result?.value;return {- async shoot(url: string, ready: string, file: string, height = HEIGHT) {+ /** Photographs the page once `ready` shows, and answers where the rail's button is (null without one). */+ async shoot(url: string, ready: string, file: string, height = HEIGHT): Promise<{ left: number; top: number } | null> {await send("Emulation.setDeviceMetricsOverride", { width: WIDTH, height, deviceScaleFactor: 2, mobile: false });await send("Page.navigate", { url });const end = Date.now() + 60_000;@@ -103,6 +118,7 @@ async function openChrome(profile: string) {await delay(900);const { data } = await send("Page.captureScreenshot", { format: "png" });writeFileSync(file, Buffer.from(data, "base64"));+ return await evaluate("(() => { const box = document.querySelector('[data-rail-toggle]')?.getBoundingClientRect(); return box ? { left: box.left, top: box.top } : null; })()");},close() { socket.close(); chrome.kill(); },};@@ -122,6 +138,7 @@ try {const chrome = await openChrome(profile);try {let banner = false;+ const spots = new Map<string, Array<{ view: string; at: { left: number; top: number } | null }>>();for (const view of VIEWS.filter((entry) => !only || only.has(entry.name))) for (const skin of SKINS) {if (view.banner && !banner) {const kept = await fetch(`${fixture.info.url}/api/workspace/banner`, { method: "PUT", headers: { "content-type": "image/png", origin: fixture.info.url }, body: new Uint8Array(duskPng()) });@@ -129,9 +146,14 @@ try {banner = true;}const file = join(shots, `${view.name}-${skin.look}.png`);- await chrome.shoot(`${ui.previewUrl}?skin=${skin.id}${view.query ? `&${view.query}` : ""}`, view.ready, file, view.height);+ const at = await chrome.shoot(`${ui.previewUrl}?skin=${skin.id}${view.query ? `&${view.query}` : ""}`, view.ready, file, view.height);+ if (view.button) spots.set(view.button, [...spots.get(view.button) ?? [], { view: `${view.name}-${skin.look}`, at }]);console.log(file);}+ for (const [spot, seen] of spots) {+ console.log(JSON.stringify({ button: spot, at: seen }));+ if (seen.some(({ at }) => !at || at.left !== seen[0]!.at?.left || at.top !== seen[0]!.at?.top)) throw new Error(`the rail's button moved (${spot})`);+ }} finally {chrome.close();await delay(500);diff --git a/src/components/ChromeRail.tsx b/src/components/ChromeRail.tsxindex 9a58011a43..1eb463fd34 100644--- a/src/components/ChromeRail.tsx+++ b/src/components/ChromeRail.tsx@@ -13,6 +13,6 @@ export function ChromeRail() {const [, setEpoch] = useState(0);useEffect(() => { setLocale(language || globalThis.navigator?.language); setEpoch((epoch) => epoch + 1); }, [language]);// The page beside the rail chose its skin: the rail wears the same one.- useEffect(() => window.ogb?.rail?.onSkin(wearSkin), []);+ useEffect(() => window.ogb?.rail?.onSkin?.(wearSkin), []);return <DesktopCapabilitiesProvider><div data-chrome-rail className="h-full"><PlacesRail chrome /></div></DesktopCapabilitiesProvider>;}diff --git a/src/components/ChromeRailToggle.test.ts b/src/components/ChromeRailToggle.test.tsnew file mode 100644index 0000000000..6434ffc8d4--- /dev/null+++ b/src/components/ChromeRailToggle.test.ts@@ -0,0 +1,83 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import type { ChromeRailBridge, ChromeRailState } from "../../electron/chrome-rail.mjs";++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+let host: HTMLDivElement, root: Root | null = null;+beforeEach(() => { host = document.createElement("div"); document.body.append(host); });+afterEach(async () => { await act(async () => root?.unmount()); root = null; host.remove(); vi.resetModules(); });++/** Main's side of the bridge: its answer to the page's offer, and to a click (refused when `refuse`). */+function bridge(answer: ChromeRailState | Error, { refuse = false } = {}) {+ let push: (state: ChromeRailState) => void = () => {};+ const rail = {+ state: vi.fn(() => (answer instanceof Error ? Promise.reject(answer) : Promise.resolve(answer))),+ setHidden: vi.fn((hidden: boolean) => (refuse ? Promise.reject(new Error("Choose to hide or show your computers.")) : Promise.resolve({ available: true, hidden }))),+ onState: vi.fn((callback: (state: ChromeRailState) => void) => { push = callback; return () => {}; }),+ };+ return { rail, push: (state: ChromeRailState) => act(async () => push(state)) };+}++/** A fresh page with the sidebar's button and Settings' switch, as this window's bridge answers them. */+async function page(rail: ChromeRailBridge | undefined) {+ vi.resetModules();+ Object.assign(window, { ogb: rail ? { rail } : undefined });+ const { setLocale } = await import("@/lib/i18n");+ setLocale("en");+ const { ChromeRailRow, ChromeRailToggle } = await import("./ChromeRailToggle");+ root = createRoot(host);+ await act(async () => {+ root!.render(createElement("div", null, createElement(ChromeRailToggle, { advanced: true, icons: false }),+ createElement("div", { "data-settings-look": "simple" }, createElement(ChromeRailRow))));+ });+ await act(async () => { await Promise.resolve(); });+}+const button = () => host.querySelector<HTMLButtonElement>("[data-rail-toggle]");+const toggle = () => host.querySelector<HTMLButtonElement>("[data-rail-switch] [role='switch']");+const said = () => [button()?.getAttribute("aria-label"), button()?.getAttribute("title"), button()?.getAttribute("aria-expanded"), toggle()?.getAttribute("aria-checked")];+const click = async (target: HTMLElement | null) => {+ expect(target).toBeTruthy();+ await act(async () => { target!.click(); await Promise.resolve(); });+ await act(async () => { await Promise.resolve(); });+};++it("once main says this window has a rail, the button hides it and shows it again, and the switch in Settings says the same", async () => {+ const { rail } = bridge({ available: true, hidden: false });+ await page(rail);+ expect(rail.state, "one offer from the page, whatever asks").toHaveBeenCalledTimes(1);+ expect(said()).toEqual(["Hide your computers", "Hide your computers", "true", "true"]);+ const row = host.querySelector("[data-rail-switch]")!.textContent!;+ for (const words of ["Show your computers", "A circle for each place your bots live, at the window's left edge."]) expect(row).toContain(words);+ await click(button());+ expect(rail.setHidden).toHaveBeenLastCalledWith(true);+ expect(said()).toEqual(["Show your computers", "Show your computers", "false", "false"]);+ await click(toggle());+ expect(rail.setHidden).toHaveBeenLastCalledWith(false);+ expect(said()).toEqual(["Hide your computers", "Hide your computers", "true", "true"]);+});++it("main's word wins: a click it refuses puts the button back, and with one place left the button and the switch go", async () => {+ const { rail, push } = bridge({ available: true, hidden: false }, { refuse: true });+ await page(rail);+ await click(button());+ expect(rail.setHidden).toHaveBeenCalledWith(true);+ expect(said()).toEqual(["Hide your computers", "Hide your computers", "true", "true"]);+ await push({ available: false, hidden: false });+ expect([button(), toggle()]).toEqual([null, null]);+ await push({ available: true, hidden: true });+ expect(said()).toEqual(["Show your computers", "Show your computers", "false", "false"]);+});++it("nothing in a browser, on an older app, on a page that isn't beside the rail, or with one place", async () => {+ const older: ChromeRailBridge = { expand: async () => {}, onSkin: () => () => {} };+ const elsewhere = bridge(new Error("rail:offer is only available to the page beside the window's rail")).rail;+ const onePlace = bridge({ available: false, hidden: true }).rail;+ for (const rail of [undefined, older, elsewhere, onePlace]) {+ await page(rail);+ expect([button(), toggle()]).toEqual([null, null]);+ await act(async () => root?.unmount());+ root = null;+ }+});diff --git a/src/components/ChromeRailToggle.tsx b/src/components/ChromeRailToggle.tsxnew file mode 100644index 0000000000..632e2e294c--- /dev/null+++ b/src/components/ChromeRailToggle.tsx@@ -0,0 +1,42 @@+import type { CSSProperties } from "react";+import { cn } from "@/lib/cn";+import { setChromeRailHidden, useChromeRail } from "@/lib/chrome-rail";+import { t } from "@/lib/i18n";+import { SettingRow, Switch } from "./SettingsPrimitives";+import { SIMPLE_TOP_TOGGLE } from "./SidebarSimpleTop";++/** The window's rail of places, drawn small: a window with the rail at its left edge and three places on it. */+export function RailStripIcon({ size }: { size: number }) {+ return <svg aria-hidden="true" width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round">+ <rect x="3" y="3" width="18" height="18" rx="2" />+ <path d="M9 3v18" />+ <circle cx="6" cy="7.5" r="0.75" fill="currentColor" />+ <circle cx="6" cy="12" r="0.75" fill="currentColor" />+ <circle cx="6" cy="16.5" r="0.75" fill="currentColor" />+ </svg>;+}++/** The sidebar's button that hides and shows the window's rail of places, while this window has one. It takes the look+ * of the top row's other buttons: Simple's, Advanced's, or Advanced's column when the sidebar shows only avatars. */+export function ChromeRailToggle({ advanced, icons, style }: { advanced: boolean; icons: boolean; style?: CSSProperties }) {+ const rail = useChromeRail();+ if (!rail?.available) return null;+ const label = t(rail.hidden ? "rail.show" : "rail.hide");+ return <button type="button" data-rail-toggle aria-label={label} title={label} aria-expanded={!rail.hidden} style={style}+ onClick={() => setChromeRailHidden(!rail.hidden)}+ className={advanced ? cn("flex shrink-0 items-center justify-center text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",+ icons ? "size-[46px] rounded-xl" : "size-8 rounded-full") : SIMPLE_TOP_TOGGLE}>+ <RailStripIcon size={advanced && icons ? 20 : 18} />+ </button>;+}++/** Settings' switch for the same rail, while this window has one. */+export function ChromeRailRow() {+ const rail = useChromeRail();+ if (!rail?.available) return null;+ return <div data-rail-switch>+ <SettingRow title={t("rail.show")} subtitle={t("rail.showSub")}>+ <Switch checked={!rail.hidden} aria-label={t("rail.show")} onClick={() => setChromeRailHidden(!rail.hidden)} />+ </SettingRow>+ </div>;+}diff --git a/src/components/PlaceLookCard.tsx b/src/components/PlaceLookCard.tsxindex fde088d74d..0c1458b625 100644--- a/src/components/PlaceLookCard.tsx+++ b/src/components/PlaceLookCard.tsx@@ -9,11 +9,11 @@ import { PlacePicture } from "./PlacePicture";import { SettingRow, SettingsRows, SIMPLE_BUTTONS } from "./SettingsPrimitives";import { SwatchRadios } from "./SwatchRadios";-/** The sidebar's look, in one card in the Simple look wherever it shows: its colour, in the six swatches the rail's- * circles use, and its picture, kept on the place's own server for everyone there. Both start plain. This computer's- * colour is the app's own; a Cloud's is the Admin's, so every app of theirs follows it, and a team member sees both and- * who may change them. A browser knows no colour, only the picture. */-export function PlaceLookCard() {+/** The sidebar's look, as two rows of Settings: its colour, in the six swatches the rail's circles use, and its picture,+ * kept on the place's own server for everyone there. Both start plain. This computer's colour is the app's own; a+ * Cloud's is the Admin's, so every app of theirs follows it, and a team member sees both and who may change them. A+ * browser knows no colour, only the picture. */+export function PlaceLookRows() {const look = usePlaceLook();const { state } = useStore();const admin = useOwnerOrAdmin() === true;@@ -28,16 +28,21 @@ export function PlaceLookCard() {};const note = look?.reason === "member" || outcome === "refused" ? t("placeLook.member") : look?.reason === "signed-out" ? t("placeLook.signedOut"): outcome === "unsupported" ? t("placeLook.unsupported") : null;+ return <>+ {look && <div data-place-look={look.change ?? "locked"}>+ <SettingRow title={t("placeLook.sidebarColor")} subtitle={computer ? t("placeLook.sidebarColorSub") : t("placeLook.sub", { name: look.name })}+ message={outcome === "failed" ? <p role="alert" className="text-danger">{t("placeLook.failed")}</p> : note && <p className="text-ink-secondary">{note}</p>}>+ <SwatchRadios value={pending ?? look.swatch} onChange={choose} label={computer ? t("placeLook.sidebarColor") : t("placeLook.aria", { name: look.name })}+ disabled={locked} offset="menu" none />+ </SettingRow>+ </div>}+ <PlacePicture banner={state.config?.workspaceBanner ?? null} canChange={admin} subtitle={t(computer ? "placeLook.sidebarPictureSub" : "placeLook.pictureSub")} />+ </>;+}++/** The same rows in a card of their own, in the Simple look in Advanced too. */+export function PlaceLookCard() {return <div data-sidebar-look data-settings-look="simple" className={SIMPLE_BUTTONS}>- <SettingsRows>- {look && <div data-place-look={look.change ?? "locked"}>- <SettingRow title={t("placeLook.sidebarColor")} subtitle={computer ? t("placeLook.sidebarColorSub") : t("placeLook.sub", { name: look.name })}- message={outcome === "failed" ? <p role="alert" className="text-danger">{t("placeLook.failed")}</p> : note && <p className="text-ink-secondary">{note}</p>}>- <SwatchRadios value={pending ?? look.swatch} onChange={choose} label={computer ? t("placeLook.sidebarColor") : t("placeLook.aria", { name: look.name })}- disabled={locked} offset="menu" none />- </SettingRow>- </div>}- <PlacePicture banner={state.config?.workspaceBanner ?? null} canChange={admin} subtitle={t(computer ? "placeLook.sidebarPictureSub" : "placeLook.pictureSub")} />- </SettingsRows>+ <SettingsRows><PlaceLookRows /></SettingsRows></div>;}diff --git a/src/components/PlacesRail.test.ts b/src/components/PlacesRail.test.tsindex 4ca5b419be..1a8126abf5 100644--- a/src/components/PlacesRail.test.ts+++ b/src/components/PlacesRail.test.ts@@ -270,14 +270,17 @@ it("a server of the person's own on an older release than the newest has a quietexpect(host.querySelector('[data-rail-place="s-old"] [data-rail-dot]')).toBeTruthy();});-it("the window's own rail: drawn at every width, the place on screen named under its circle, and its sheets cover the window while open", async () => {+it("the window's own rail: drawn at every width, small circles named on hover, and its sheets cover the window while open", async () => {const expand = vi.fn(async () => {});Object.assign(window, { ogb: { workspaces, cloudAdd, rail: { expand, onSkin: () => () => {} } } });await mount(createElement(PlacesRail, { chrome: true }));const nav = host.querySelector("[data-places-rail]")!;expect(nav.className).toContain("flex h-full");expect(nav.className, "never hidden on a narrow window").not.toContain("hidden");- expect([...host.querySelectorAll("[data-rail-caption]")].map((caption) => caption.textContent)).toEqual(["My Cloud"]);+ expect(nav.textContent, "no name under the place on screen: its circle's ring marks it").toBe("MCCAACBCCO");+ expect(host.querySelector('[data-rail-place="home"]')?.getAttribute("title")).toBe("My Cloud");+ expect(host.querySelector('[data-rail-place="home"] span')?.getAttribute("style")).toContain("width: 32px; height: 32px");+ expect(host.querySelector("[data-rail-add]")?.className).toContain("size-8");expect(expand.mock.calls.at(-1)).toEqual([false]);await click(host.querySelector("[data-rail-add]"));expect(expand.mock.calls.at(-1), "+'s sheet covers the window").toEqual([true]);diff --git a/src/components/PlacesRail.tsx b/src/components/PlacesRail.tsxindex 8481afc7c7..f70cc557ff 100644--- a/src/components/PlacesRail.tsx+++ b/src/components/PlacesRail.tsx@@ -20,7 +20,7 @@ import { SwatchRadios } from "./SwatchRadios";/** Circles before ⋯ opens the searchable list of every place. */export const RAIL_SHOWN = 8;-const CIRCLE = 38;+const CIRCLE = 32;/** A circle's words for its tooltip and a screen reader: the place, and what it is doing now. A server of the person's* own that signed in with their account says so, whether it is online, and why there is nothing to open when it is only@@ -102,10 +102,10 @@ function PlaceCircle({ place, calm, canPair, onOpen, onMenu }: { place: RailPlac: acts ? "hover:ring-2 hover:ring-ink/15 hover:ring-offset-2 hover:ring-offset-panel" : cn("cursor-default", !place.offline && "opacity-75"))}><PlaceMark place={place} />{place.progress !== undefined && <ProgressRing value={place.progress} waiting={place.waiting === true} />}- {place.attention && <span aria-hidden="true" data-rail-dot className="absolute -right-0.5 -top-0.5 size-3 rounded-full border-2 border-panel bg-danger" />}- {place.update && !place.attention && <span aria-hidden="true" data-rail-update className="absolute -right-0.5 -top-0.5 size-3 rounded-full border-2 border-panel bg-accent" />}- {place.server && <span aria-hidden="true" data-rail-server className="absolute -bottom-0.5 -right-0.5 grid size-4 place-items-center rounded-full border border-hairline bg-panel text-ink-secondary">- <Server size={9} strokeWidth={2.25} />+ {place.attention && <span aria-hidden="true" data-rail-dot className="absolute -right-0.5 -top-0.5 size-2.5 rounded-full border-2 border-panel bg-danger" />}+ {place.update && !place.attention && <span aria-hidden="true" data-rail-update className="absolute -right-0.5 -top-0.5 size-2.5 rounded-full border-2 border-panel bg-accent" />}+ {place.server && <span aria-hidden="true" data-rail-server className="absolute -bottom-0.5 -right-0.5 grid size-3.5 place-items-center rounded-full border border-hairline bg-panel text-ink-secondary">+ <Server size={8} strokeWidth={2.25} /></span>}</button>;}@@ -190,7 +190,7 @@ export function PlacesRail({ chrome = false }: { chrome?: boolean }) {return () => window.removeEventListener("mousedown", away);}, [more, menu]);const covering = more || adding || connecting !== null || menu !== null;- useEffect(() => { if (chrome) void window.ogb?.rail?.expand(covering)?.catch(() => {}); }, [chrome, covering]);+ useEffect(() => { if (chrome) void window.ogb?.rail?.expand?.(covering)?.catch(() => {}); }, [chrome, covering]);if (!state.places.length) return null;const bridge = window.ogb?.workspaces;const open = (place: RailPlace) => {@@ -214,25 +214,21 @@ export function PlacesRail({ chrome = false }: { chrome?: boolean }) {className={cn("relative w-16 shrink-0 flex-col items-center bg-panel", chrome ? "flex h-full" : "hidden md:flex", calm ? "border-r border-ink/[0.04]" : "border-r border-hairline/50")}>{/* The macOS traffic lights sit over the rail's top; nothing here takes a click before they end. */}<div aria-hidden="true" className={macInset ? "h-[52px] shrink-0" : "h-3 shrink-0"} />- <ul className="flex min-h-0 flex-col items-center gap-2.5 overflow-y-auto px-1 py-1" style={noDrag}>- {shown.map((place) => <li key={place.id} className="flex flex-col items-center">+ <ul className="flex min-h-0 flex-col items-center gap-2 overflow-y-auto px-1 py-1" style={noDrag}>+ {shown.map((place) => <li key={place.id} className="flex"><PlaceCircle place={place} calm={calm} canPair={canPair} onOpen={open} onMenu={openMenu} />- {/* The place on screen, named: a server's own page may name it nowhere. */}- {place.active && <span aria-hidden="true" data-rail-caption className="mt-1 line-clamp-2 w-[60px] break-words text-center text-[11px] leading-tight text-ink-secondary">- {place.kind === "computer" ? t("rail.thisComputer") : place.name}- </span>}</li>)}</ul>- <div className="relative mt-2.5 flex flex-col items-center gap-2.5 pb-3" style={noDrag} ref={moreRef}>+ <div className="relative mt-2 flex flex-col items-center gap-2 pb-3" style={noDrag} ref={moreRef}>{state.places.length > RAIL_SHOWN && <button type="button" aria-label={t("rail.more", { count: state.places.length })} title={t("rail.more", { count: state.places.length })}aria-haspopup="dialog" aria-expanded={more} data-rail-more-button onClick={() => setMore(!more)}- className="grid size-[38px] place-items-center rounded-full text-ink-secondary hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus aria-expanded:bg-ink/[0.06]">- <MoreHorizontal size={18} aria-hidden="true" />+ className="grid size-8 place-items-center rounded-full text-ink-secondary hover:bg-ink/[0.06] hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus aria-expanded:bg-ink/[0.06]">+ <MoreHorizontal size={16} aria-hidden="true" /></button>}{more && <MorePlaces places={state.places} canPair={canPair} onOpen={open} onMenu={openMenu} onClose={() => setMore(false)} />}{canAdd && <button type="button" aria-label={t("rail.add")} title={t("rail.add")} aria-haspopup="dialog" data-rail-add onClick={() => { track("rail_add", { step: "opened" }); setAdding(true); }}- className="grid size-[38px] place-items-center rounded-full border border-dashed border-ink/25 text-ink-secondary hover:border-ink/40 hover:bg-ink/[0.04] hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus">- <Plus size={18} aria-hidden="true" />+ className="grid size-8 place-items-center rounded-full border border-dashed border-ink/25 text-ink-secondary hover:border-ink/40 hover:bg-ink/[0.04] hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus">+ <Plus size={16} aria-hidden="true" /></button>}</div>{/* The list is read again while it is open: the menu shows the place as main lists it now. */}diff --git a/src/components/SettingsModal.appearance.test.ts b/src/components/SettingsModal.appearance.test.tsindex 463b26bcea..911cbf6875 100644--- a/src/components/SettingsModal.appearance.test.ts+++ b/src/components/SettingsModal.appearance.test.ts@@ -30,6 +30,8 @@ const fixture = vi.hoisted(() => ({api: vi.fn(),dispatch: vi.fn(),switches: [] as ComponentProps<typeof Switch>[],+ rail: null as { available: boolean; hidden: boolean } | null,+ railHidden: [] as boolean[],}));// The Cloud account card reads the host platform (what a saved sign-in still locked asks for).vi.mock("./DesktopCapabilities", () => ({ useDesktopCapabilities: () => ({ capabilities: { host: { platform: "darwin" } } }) }));@@ -78,6 +80,7 @@ vi.mock("@/lib/interface-mode", () => ({}));vi.mock("@/lib/analytics", () => ({ analyticsEnabled: () => false, setAnalyticsEnabled: vi.fn() }));vi.mock("./PeopleSection", () => ({ PeopleSection: () => null }));+vi.mock("@/lib/chrome-rail", () => ({ useChromeRail: () => fixture.rail, setChromeRailHidden: (hidden: boolean) => fixture.railHidden.push(hidden) }));vi.mock("./SettingsPrimitives", async (importOriginal) => {const original = await importOriginal<typeof import("./SettingsPrimitives")>();return {@@ -102,6 +105,8 @@ beforeEach(() => {// these pin the Advanced rail; Simple has its own suite (SettingsModal.simple.test.ts)fixture.advancedMode = true;fixture.switches = [];+ fixture.rail = null;+ fixture.railHidden = [];vi.stubGlobal("window", {});vi.stubGlobal("document", { documentElement: { dataset: {} } });setLocale("en");@@ -171,6 +176,19 @@ describe("Settings → Appearance", () => {expect(html).not.toContain("Maximum turn length");});+ it("keeps the switch for the window's rail of places with the sidebar's rows, where this window has one", () => {+ expect(render()).not.toContain("Show your computers");+ fixture.rail = { available: true, hidden: true };+ const html = render();+ const at = html.indexOf('aria-label="Show your computers"');+ expect(at).toBeGreaterThan(html.indexOf(">Sidebar density<"));+ expect(at).toBeLessThan(html.indexOf('aria-label="Show threads"'));+ const toggle = fixture.switches.find((props) => props["aria-label"] === "Show your computers")!;+ expect(toggle.checked).toBe(false);+ toggle.onClick!({} as never);+ expect(fixture.railHidden).toEqual([false]);+ });+it.each([true, false])("only updates the local preference when the switch is %s", (enabled) => {fixture.showThreads = enabled;render();diff --git a/src/components/SettingsModal.simple.test.ts b/src/components/SettingsModal.simple.test.tsindex cf03c18254..f6b4ef721e 100644--- a/src/components/SettingsModal.simple.test.ts+++ b/src/components/SettingsModal.simple.test.ts@@ -5,7 +5,7 @@ import { setLocale, t } from "@/lib/i18n";import type { AppSettingsSection } from "@/state/store";import type { Switch } from "./SettingsPrimitives";import { SECTIONS, SIMPLE_FOLDED, SIMPLE_HIDDEN_SECTIONS, SIMPLE_PAGES, SettingsModal, revealSettingsBlock } from "./SettingsModal";-import { SIMPLE_ADVANCED_ONLY } from "./SettingsSimplePages";+import { SIMPLE_ADVANCED_ONLY, SimpleLooksPage } from "./SettingsSimplePages";const fixture = vi.hoisted(() => ({section: "general" as AppSettingsSection,@@ -17,6 +17,8 @@ const fixture = vi.hoisted(() => ({ownerOrAdmin: null as boolean | null,updater: null as import("@/lib/updater").UpdaterState | null,serverUpdate: null as ReturnType<typeof import("./SidebarProfileMenu").useServerUpdateItem>,+ rail: null as { available: boolean; hidden: boolean } | null,+ railHidden: [] as boolean[],}));vi.mock("./DesktopCapabilities", () => ({ useDesktopCapabilities: () => ({ capabilities: {} }) }));@@ -31,6 +33,7 @@ vi.mock("@/lib/interface-mode", () => ({}));vi.mock("@/lib/analytics", () => ({ analyticsEnabled: () => false, setAnalyticsEnabled: vi.fn() }));vi.mock("@/lib/use-owner-or-admin", () => ({ useOwnerOrAdmin: () => fixture.ownerOrAdmin }));+vi.mock("@/lib/chrome-rail", () => ({ useChromeRail: () => fixture.rail, setChromeRailHidden: (hidden: boolean) => fixture.railHidden.push(hidden) }));vi.mock("./SettingsPrimitives", async (importOriginal) => {const original = await importOriginal<typeof import("./SettingsPrimitives")>();return {@@ -87,6 +90,8 @@ beforeEach(() => {fixture.ownerOrAdmin = null;fixture.updater = null;fixture.serverUpdate = null;+ fixture.rail = null;+ fixture.railHidden = [];fixture.api.mockResolvedValue({});vi.stubGlobal("window", desktop);vi.stubGlobal("document", { documentElement: { dataset: {} } });@@ -157,6 +162,34 @@ describe("Settings in Simple mode", () => {expect(html).toMatch(/aria-expanded="false" aria-controls="[^"]+"[^>]*>Add<\/button>/);});+ it("puts the sidebar's colour and picture right under Theme in General, the switch for the window's rail beside them, and only the skins behind More looks", () => {+ fixture.rail = { available: true, hidden: false };+ const html = render();+ const appearance = html.slice(html.indexOf('data-settings-block="appearance"'), html.indexOf(">Notifications<"));+ const order = ['role="radiogroup" aria-label="Theme"', ">Sidebar picture<", 'aria-label="Show your computers"', 'aria-label="Color my messages with the bot's color"', ">More looks<"]+ .map((needle) => appearance.indexOf(needle));+ expect(order.every((at) => at > -1), String(order)).toBe(true);+ expect(order).toEqual([...order].sort((a, b) => a - b));+ expect(appearance).toContain("A circle for each place your bots live, at the window's left edge.");+ const toggle = fixture.switches.find((props) => props["aria-label"] === "Show your computers")!;+ expect(toggle.checked).toBe(true);+ toggle.onClick!({} as never);+ expect(fixture.railHidden).toEqual([true]);+ const looks = renderToStaticMarkup(createElement(SimpleLooksPage, { onBack: () => {} }));+ expect(looks).toContain('data-settings-block="looks"');+ expect(looks).not.toContain("data-place-picture");+ });++ it("shows the rail's switch only where this window has a rail to hide", () => {+ for (const rail of [null, { available: false, hidden: true }]) {+ fixture.rail = rail;+ expect(render()).not.toContain("Show your computers");+ }+ fixture.rail = { available: true, hidden: true };+ render();+ expect(fixture.switches.find((props) => props["aria-label"] === "Show your computers")?.checked).toBe(false);+ });+it("keeps the everyday rows and leaves the fifteen builder controls to Advanced, where search still points", () => {const general = open("general");for (const shown of ['aria-label="Send usage analytics"', 'aria-label="Color my messages with the bot's color"', 'aria-label="Send messages with"',diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsxindex 6270243fe6..5513a89149 100644--- a/src/components/SettingsModal.tsx+++ b/src/components/SettingsModal.tsx@@ -28,6 +28,7 @@ import { LoginsSettings } from "./LoginsSettings";import { RemoteComputerSection } from "./RemoteComputerSection";import { ConnectedWorkspacesSettings } from "./ConnectedWorkspacesSettings";import { PlaceLookCard } from "./PlaceLookCard";+import { ChromeRailRow } from "./ChromeRailToggle";import { OrganizationSettings } from "./OrganizationSettings";import { CloudAccountSettings } from "./CloudAccountSettings";import { ProSettingsCard } from "./ProIntroduction";@@ -81,7 +82,7 @@ export const SECTIONS: Array<{keywords: string[];}> = [{ id: "general", group: "you", labelKey: "settings.section.general", icon: User, keywords: ["profile", "pinned panels", "web panel", "dashboard", "pin a page", "name", "email", "about me", "about", "suggestions", "suggested", "memory", "analytics", "updates", "product updates", "newsletter", "email updates", "effort", "new bots", "reasoning", "threads", "parallel", "concurrency", "cleanup", "retention", "event log", "event-log", "log size", "automatic recovery", "backup model", "fallback", "routines", "conversation", "schedule", "usage", "limit", "plan", "upgrade", "cloud desktop hours", "storage", ...talkShortcutKeywords()] },- { id: "appearance", group: "you", labelKey: "settings.section.appearance", icon: Palette, keywords: ["skin", "theme", "appearance", "chat width", "width", "wide", "full width", "bubble", "bubbles", "tools", "tool calls", "threads", "show threads", "hide threads", "sidebar", "density", "compact", "comfortable", "avatars", "display", "run", "this run", "run card", "commands", "notifications", "sound", "sounds", "mute", "silent", "chime", "pinned", "circles", "universal", "groups", "top", "send", "enter", "return", "shift+enter", "ctrl+enter", "cmd+enter", "⌘+enter", "new line", "keyboard", "ime", "japanese", "message color", "my messages", "toolbar", "tools layout", "footer", "routines", "triggers", "team map", "color", "colour", "cloud color", "server color", "tint", "sidebar color", "sidebar picture", "picture", "image", "banner", "background"] },+ { id: "appearance", group: "you", labelKey: "settings.section.appearance", icon: Palette, keywords: ["skin", "theme", "appearance", "chat width", "width", "wide", "full width", "bubble", "bubbles", "tools", "tool calls", "threads", "show threads", "hide threads", "sidebar", "density", "compact", "comfortable", "avatars", "display", "run", "this run", "run card", "commands", "notifications", "sound", "sounds", "mute", "silent", "chime", "pinned", "circles", "universal", "groups", "top", "send", "enter", "return", "shift+enter", "ctrl+enter", "cmd+enter", "⌘+enter", "new line", "keyboard", "ime", "japanese", "message color", "my messages", "toolbar", "tools layout", "footer", "routines", "triggers", "team map", "color", "colour", "cloud color", "server color", "tint", "sidebar color", "sidebar picture", "picture", "image", "banner", "background", "computers", "your computers", "rail", "strip"] },{ id: "companion", group: "you", labelKey: "settings.section.companion", icon: TabletSmartphone, keywords: ["companion", "device", "phone", "desktop", "client", "host", "pair", "pairing", "mobile", "https", "secure", "tailscale", "wifi", "remote", "advanced", "domain", "dns", "self-hosted", "server", "caddy"] },{ id: "engines", group: "ai", labelKey: "settings.section.engines", icon: Terminal, keywords: ["models", "model providers", "engines", "claude", "codex", "grok", "providers", "cli", "sign in", "subscription"] },{ id: "connections", group: "ai", labelKey: "settings.section.connections", icon: KeyRound, keywords: ["keys", "api", "api key", "api keys", "connections", "composio", "box", "xai", "mistral", "cerebras", "meta", "muse", "vps", "router", "openrouter", "base url", "openai", "anthropic", "groq", "opencode", "deepseek", "provider", "lm studio", "lmstudio", "llm studio", "llmstudio", "bionic"] },@@ -376,6 +377,7 @@ export function SettingsModal() {<SendKeyRow /><SidebarDensityRow /><SidebarToolsLayoutRow />+ <ChromeRailRow /><ShowThreadsRow /><PinnedCirclesRow /><UniversalPinsRow />diff --git a/src/components/SettingsSimplePages.tsx b/src/components/SettingsSimplePages.tsxindex daeacd683a..07dac1f7a5 100644--- a/src/components/SettingsSimplePages.tsx+++ b/src/components/SettingsSimplePages.tsx@@ -23,7 +23,8 @@ import { SettingRow, SettingsDisclosureRow, SettingsGroup, SettingsRows } from "import { UsageSection } from "./UsageSection";import { PlanUsageSummary } from "./PlanUsage";import { SkinPicker } from "./SkinPicker";-import { PlaceLookCard } from "./PlaceLookCard";+import { PlaceLookRows } from "./PlaceLookCard";+import { ChromeRailRow } from "./ChromeRailToggle";import { ProfileSummaryRow } from "./ProfileSettings";import { ImportSettings } from "./ImportSettings";import { NotificationRows } from "./NotificationSettingsRows";@@ -59,6 +60,8 @@ export function SimpleGeneralPage({ has, peopleOpen, onLooks }: { has: Has; peop<SettingsGroup label={t("settings.section.appearance")} block="appearance"><SettingsRows><ThemeRow simple />+ <PlaceLookRows />+ <ChromeRailRow /><ColorUserBubblesRow simple /><LanguageRow simple /><SendKeyRow simple />@@ -98,7 +101,6 @@ export function SimpleLooksPage({ onBack }: { onBack: () => void }) {<><div><button type="button" className="ui-button" onClick={onBack}>{t("settings.simple.looks.back")}</button></div><div data-settings-block="looks"><SkinPicker /></div>- <PlaceLookCard /></>);}diff --git a/src/components/Sidebar.header.test.ts b/src/components/Sidebar.header.test.tsindex ec675ca415..59c18764c7 100644--- a/src/components/Sidebar.header.test.ts+++ b/src/components/Sidebar.header.test.ts@@ -12,6 +12,7 @@ const fixture = vi.hoisted(() => ({advanced: true,windowChrome: undefined as "mac-inset" | "win-caption" | "native" | undefined,hostLabel: undefined as string | undefined,+ rail: null as { available: boolean; hidden: boolean } | null,}));vi.mock("@/lib/sidebar-preferences", async (importOriginal) => ({@@ -19,6 +20,7 @@ vi.mock("@/lib/sidebar-preferences", async (importOriginal) => ({useSidebarDensity: () => fixture.density,}));vi.mock("@/lib/interface-mode", () => ({ useAdvancedMode: () => fixture.advanced, setAdvancedMode: () => {} }));+vi.mock("@/lib/chrome-rail", () => ({ useChromeRail: () => fixture.rail, setChromeRailHidden: () => {} }));vi.mock("./DesktopCapabilities", async (importOriginal) => ({...await importOriginal<typeof import("./DesktopCapabilities")>(),useDesktopCapabilities: () => {@@ -39,6 +41,7 @@ beforeEach(() => {fixture.advanced = true;fixture.windowChrome = undefined;fixture.hostLabel = undefined;+ fixture.rail = null;vi.stubGlobal("window", { innerWidth: 1280, location: { protocol: "http:", search: "" } });setLocale("en");});@@ -242,6 +245,68 @@ describe("sidebar top row", () => {});});+describe("the button that hides and shows the window's rail of places", () => {+ const row = () => {+ const html = render();+ return html.slice(html.indexOf("data-sidebar-top-row"), html.indexOf('aria-label="New or share"'));+ };+ const toggle = (html: string) => /<button type="button" data-rail-toggle="true"[^>]*>/.exec(html)?.[0] ?? "";+ beforeEach(() => {+ vi.stubGlobal("window", { innerWidth: 1280, location: { protocol: "http:", search: "" }, ogb: { workspaces: { state: () => new Promise(() => {}), menu: () => Promise.resolve() } } });+ fixture.windowChrome = "mac-inset";+ fixture.rail = { available: true, hidden: false };+ });++ it("sits right after the macOS traffic lights, round like the row's other buttons, its words saying what a click does", () => {+ const advanced = row();+ expect(advanced.indexOf("data-traffic-light-space")).toBeLessThan(advanced.indexOf("data-rail-toggle"));+ expect(advanced.indexOf("data-rail-toggle")).toBeLessThan(advanced.indexOf("data-sidebar-top-slot"));+ expect(toggle(advanced)).toMatch(/aria-label="Hide your computers" title="Hide your computers" aria-expanded="true" style="-webkit-app-region:no-drag" class="[^"]*\bsize-8\b[^"]*\brounded-full\b/);+ expect(advanced).toMatch(/data-rail-toggle="true"[^>]*><svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect[^>]*><\/rect><path d="M9 3v18"><\/path>(<circle[^>]*fill="currentColor"><\/circle>){3}<\/svg>/);+ fixture.advanced = false;+ const simple = row();+ expect(simple.indexOf("data-traffic-light-space")).toBeLessThan(simple.indexOf("data-rail-toggle"));+ expect(simple.indexOf("data-rail-toggle")).toBeLessThan(simple.indexOf("data-sidebar-top-slot"));+ expect(toggle(simple)).toMatch(/class="[^"]*\bsize-9\b[^"]*\brounded-full\b[^"]*\bbg-composer\b/);+ expect(toggle(simple), "the rail is shown most of the time: no open-menu tint for it").not.toContain("aria-expanded:bg-");+ fixture.rail = { available: true, hidden: true };+ expect(toggle(row())).toContain('aria-label="Show your computers" title="Show your computers" aria-expanded="false"');+ });++ it("lands where it was with the rail beside the page or not: the traffic lights' space gives back the room the rail takes", () => {+ expect(/data-traffic-light-space="true" class="([^"]*)"/.exec(row())?.[1]).toBe("w-[72px] shrink-0 md:w-[calc(72px_-_var(--rail-beside,0px))]");+ });++ it("tops the column of buttons when the sidebar shows only avatars, and leads the row on Windows and Linux", () => {+ fixture.density = "icons";+ const column = render();+ expect(column.indexOf("data-traffic-light-space")).toBeLessThan(column.indexOf("data-rail-toggle"));+ expect(column.indexOf("data-rail-toggle")).toBeLessThan(column.indexOf("data-sidebar-top-buttons"));+ expect(toggle(column)).toMatch(/class="[^"]*\bsize-\[46px\][^"]*\brounded-xl\b/);+ fixture.advanced = false;+ const rail = render();+ expect(rail.indexOf("data-rail-toggle")).toBeLessThan(rail.indexOf("data-sidebar-rail-top"));+ expect(toggle(rail)).toMatch(/class="[^"]*\bsize-9\b[^"]*\brounded-full\b/);+ fixture.advanced = true;+ fixture.density = "comfortable";+ for (const [windowChrome, hostLabel] of [["win-caption", "Windows"], ["native", "Linux"]] as const) {+ fixture.windowChrome = windowChrome;+ fixture.hostLabel = hostLabel;+ const html = row(), at = html.indexOf('<button type="button" data-rail-toggle');+ expect(at, windowChrome).toBeGreaterThan(-1);+ expect(at, windowChrome).toBeLessThan(html.indexOf("data-sidebar-top-slot"));+ expect(html.slice(0, at), windowChrome).toMatch(/^data-sidebar-top-row="true" class="[^"]*"(?: style="[^"]*")?>$/);+ }+ });++ it("is nowhere without a rail to hide: one place, a browser, an older app, or a page that isn't beside it", () => {+ for (const rail of [null, { available: false, hidden: false }, { available: false, hidden: true }]) {+ fixture.rail = rail;+ expect(render()).not.toContain("data-rail-toggle");+ }+ });+});+describe("sidebar head and foot", () => {it.each(["comfortable", "compact", "icons"] as const)("puts the top row and search in the head, the places in the foot, and the fading list between at %s density",diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex 035ad2d131..763684f36d 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -90,7 +90,7 @@ import { PhoneHero } from "./SidebarPhoneHero";import { SidebarProfileMenu } from "./SidebarProfileMenu";import { PHONE_LAYOUT, useMediaQuery } from "@/lib/use-media-query";import { GlassBar, GlassScrollFrame, GlassScroller } from "./GlassScrollFrame";-import { DesktopWorkspaceSwitcher, endCloudHowTo } from "./DesktopWorkspaceSwitcher"; import { railShown, usePlaces } from "@/lib/places"; import { PlaceTint } from "./PlaceTint";+import { DesktopWorkspaceSwitcher, endCloudHowTo } from "./DesktopWorkspaceSwitcher"; import { usePlaces } from "@/lib/places"; import { PlaceTint } from "./PlaceTint"; import { ChromeRailToggle } from "./ChromeRailToggle";import { useCloudOwner } from "./CloudOwner";import { SidebarSectionHeader } from "./SidebarSectionHeader";import { NeedsYouButton, OwnerFace, OwnerPickerHost, pickOwnerOf } from "./TeamOwner"; import { SidebarPeople } from "./SidebarPeople";@@ -1137,7 +1137,7 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {}};- const macInset = capabilities.windowChrome === "mac-inset", railBeside = railShown(usePlaces());+ const macInset = capabilities.windowChrome === "mac-inset", pageRail = usePlaces().places.length > 0;const browser = capabilities.host.label === "Browser";const draggableChrome = macInset || capabilities.windowChrome === "win-caption";// SAFETY: Electron's -webkit-app-region is not in React's CSSProperties type; the renderer accepts it as an inline@@ -1406,15 +1406,15 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {{phone ? (<div className="shrink-0" style={windowNoDragStyle}><SidebarProfileMenu iconOnly circle /></div>) : macInset ? (- // The macOS 26 traffic lights span 16-76px; nothing clickable starts before 88px.- <div aria-hidden="true" data-traffic-light-space className={density === "icons" ? "h-5 w-full" : railBeside ? "w-[72px] shrink-0 md:w-3" : "w-[72px] shrink-0"} />+ // The macOS 26 traffic lights span 16-76px; nothing clickable starts before 88px, with the window's rail beside or not.+ <div aria-hidden="true" data-traffic-light-space className={density === "icons" ? "h-5 w-full" : pageRail ? "w-[72px] shrink-0 md:w-2" : "w-[72px] shrink-0 md:w-[calc(72px_-_var(--rail-beside,0px))]"} />) : browser ? (<div className={cn("flex shrink-0 items-center gap-2", density !== "icons" && "mr-3", simpleDesk && "mt-1")}><span className="size-3 rounded-full bg-[#ff5f57]" /><span className="size-3 rounded-full bg-[#febc2e]" /><span className="size-3 rounded-full bg-[#28c840]" /></div>- ) : null}+ ) : null}{!phone && <ChromeRailToggle advanced={advanced} icons={density === "icons"} style={windowNoDragStyle} />}{rail && <div data-sidebar-rail-top className="flex flex-col items-center gap-2 pt-1" style={windowNoDragStyle}><button type="button" onClick={railSearch} aria-label={t("sidebar.searchAria")} title={t("sidebar.searchAria")} className={SIMPLE_TOP_BUTTON}><Search size={18} strokeWidth={1.5} aria-hidden="true" />diff --git a/src/components/SidebarSimpleTop.tsx b/src/components/SidebarSimpleTop.tsxindex 10c3340932..0212c233d1 100644--- a/src/components/SidebarSimpleTop.tsx+++ b/src/components/SidebarSimpleTop.tsx@@ -4,12 +4,17 @@ import { createPortal } from "react-dom";import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";-import { ELEVATED_CONTROL, ELEVATED_HOVER } from "./elevated";+import { ELEVATED_CONTROL, ELEVATED_HOVER, ELEVATED_TINT } from "./elevated";/** Keyboard focus on a Simple row or tile: the focus ring drawn inside its edge. */export const SIMPLE_ROW_FOCUS = "focus-visible:outline-2 focus-visible:-outline-offset-2! focus-visible:outline-focus";-export const SIMPLE_TOP_BUTTON = `flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90 ${ELEVATED_CONTROL} ${ELEVATED_HOVER} focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`;+const SIMPLE_TOP = "flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90";+const SIMPLE_TOP_FOCUS = "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";+export const SIMPLE_TOP_BUTTON = `${SIMPLE_TOP} ${ELEVATED_CONTROL} ${ELEVATED_HOVER} ${SIMPLE_TOP_FOCUS}`;+/** The same round control for the button of the window's rail, which is shown most of the time: its aria-expanded never+ * wears the tint of an open menu. */+export const SIMPLE_TOP_TOGGLE = `${SIMPLE_TOP} ${ELEVATED_CONTROL} ${ELEVATED_TINT} ${SIMPLE_TOP_FOCUS}`;/** The round control at either end of the phone bot list's top row. */export const PHONE_TOP_BUTTON = "flex size-10 shrink-0 items-center justify-center rounded-full border border-hairline bg-card text-ink hover:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";diff --git a/src/components/elevated.ts b/src/components/elevated.tsindex a627ecd1b1..805bdf45f2 100644--- a/src/components/elevated.ts+++ b/src/components/elevated.ts@@ -2,6 +2,8 @@ export const ELEVATED_CONTROL = "bg-composer ring-1 ring-inset ring-ink/[0.07]";/** A card in the conversation, a question or an approval: the floating surface, resting on the page without a shadow. */export const ELEVATED_CARD = "bg-composer ring-[0.5px] ring-ink/10";export const ELEVATED_FLOAT = `${ELEVATED_CARD} shadow-(--shadow-float)`;-export const ELEVATED_HOVER = "transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)] aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]";+/** The hover tint alone, for a control whose aria-expanded is not a menu of its own. */+export const ELEVATED_TINT = "transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]";+export const ELEVATED_HOVER = `${ELEVATED_TINT} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`;/** The hover tint as a plain fill, for a trigger whose aria-expanded sits on a wrapping button. */export const ELEVATED_OPEN = "bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]";diff --git a/src/lib/chrome-rail.ts b/src/lib/chrome-rail.tsnew file mode 100644index 0000000000..2e900fe9ff--- /dev/null+++ b/src/lib/chrome-rail.ts@@ -0,0 +1,42 @@+import { useEffect, useState } from "react";+import type { ChromeRailState } from "../../electron/chrome-rail.mjs";++let current: ChromeRailState | null = null;+let started = false;+const listeners = new Set<(state: ChromeRailState | null) => void>();++const bridge = () => (typeof window === "undefined" ? undefined : window.ogb?.rail);++function publish(next: ChromeRailState | null) {+ current = next;+ for (const listener of listeners) listener(current);+}++function start() {+ const rail = bridge();+ if (started || !rail?.state) return;+ started = true;+ rail.onState?.(publish);+ void rail.state().then(publish, () => publish(null));+}++/** The window's own rail of places, as the page beside it knows it: null in a browser, on an older app or on a page that+ * isn't beside it. Asking offers this page's button that hides and shows it. */+export function useChromeRail(): ChromeRailState | null {+ const [state, setState] = useState(current);+ useEffect(() => {+ listeners.add(setState);+ start();+ setState(current);+ return () => { listeners.delete(setState); };+ }, []);+ return state;+}++/** From the person's click: main hides or shows the rail, and this desktop keeps the choice. */+export function setChromeRailHidden(hidden: boolean): void {+ const rail = bridge(), before = current;+ if (!rail?.setHidden || !before) return;+ publish({ ...before, hidden });+ void rail.setHidden(hidden).then(publish, () => publish(before));+}diff --git a/src/locales/de.json b/src/locales/de.jsonindex d8fdfb400d..c78c39d561 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -2550,6 +2550,9 @@"rail.update": "auf {version}, {latest} ist erschienen","rail.connectTitle": "{name} verbinden","rail.connectLede": "Er ist schon mit deinem Konto angemeldet. Öffne darauf ein Kopplungsfenster und füge den Link, den es ausgibt, hier ein.",+ "rail.hide": "Deine Computer ausblenden",+ "rail.show": "Deine Computer anzeigen",+ "rail.showSub": "Ein Kreis für jeden Ort, an dem deine Bots leben, am linken Fensterrand.","placeLook.title": "Farbe","placeLook.sub": "{name} erscheint in dieser Farbe oben in der Seitenleiste und auf dem Kreis am linken Fensterrand.","placeLook.aria": "Farbe von {name}",diff --git a/src/locales/en.json b/src/locales/en.jsonindex 3684cb9128..6a14fbe0c9 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -365,6 +365,9 @@"rail.update": "on {version}, {latest} is out","rail.connectTitle": "Connect {name}","rail.connectLede": "It's signed in to your account already. Open a pairing window on it, then paste the link it prints here.",+ "rail.hide": "Hide your computers",+ "rail.show": "Show your computers",+ "rail.showSub": "A circle for each place your bots live, at the window's left edge.","placeLook.title": "Color","placeLook.sub": "{name} shows in this color at the top of the sidebar and on its circle at the window's left edge.","placeLook.aria": "Color of {name}",diff --git a/src/locales/es.json b/src/locales/es.jsonindex f2839caeb4..843f19d507 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -313,6 +313,9 @@"rail.update": "en {version}, ya salió {latest}","rail.connectTitle": "Conectar {name}","rail.connectLede": "Ya inició sesión con tu cuenta. Abre una ventana de vinculación en él y pega aquí el enlace que muestre.",+ "rail.hide": "Ocultar tus equipos",+ "rail.show": "Mostrar tus equipos",+ "rail.showSub": "Un círculo por cada lugar donde viven tus bots, en el borde izquierdo de la ventana.","placeLook.title": "Color","placeLook.sub": "{name} se muestra en este color en la parte superior de la barra lateral y en su círculo del borde izquierdo de la ventana.","placeLook.aria": "Color de {name}",diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex c92abfddf1..a990da76e3 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -2532,6 +2532,9 @@"rail.update": "en {version}, {latest} est disponible","rail.connectTitle": "Connecter {name}","rail.connectLede": "Il est déjà connecté à votre compte. Ouvrez-y une fenêtre d'appairage, puis collez ici le lien qu'il affiche.",+ "rail.hide": "Masquer vos ordinateurs",+ "rail.show": "Afficher vos ordinateurs",+ "rail.showSub": "Un cercle pour chaque endroit où vivent vos bots, sur le bord gauche de la fenêtre.","placeLook.title": "Couleur","placeLook.sub": "{name} s'affiche dans cette couleur en haut de la barre latérale et sur son cercle, au bord gauche de la fenêtre.","placeLook.aria": "Couleur de {name}",diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex 5d79b92cf9..740aa4f317 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -2532,6 +2532,9 @@"rail.update": "{version} पर है, {latest} आ गया है","rail.connectTitle": "{name} जोड़ें","rail.connectLede": "यह आपके खाते से पहले ही साइन इन है। उस पर पेयरिंग विंडो खोलें, फिर उसका दिखाया गया लिंक यहाँ पेस्ट करें।",+ "rail.hide": "अपने कंप्यूटर छिपाएँ",+ "rail.show": "अपने कंप्यूटर दिखाएँ",+ "rail.showSub": "हर उस जगह के लिए एक गोला जहाँ आपके बॉट रहते हैं, विंडो के बाएँ किनारे पर।","placeLook.title": "रंग","placeLook.sub": "{name} साइडबार के ऊपर और विंडो के बाएँ किनारे पर अपने गोले में इसी रंग में दिखता है।","placeLook.aria": "{name} का रंग",diff --git a/src/locales/it.json b/src/locales/it.jsonindex 3e1e7211be..6b8eafc9cf 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -316,6 +316,9 @@"rail.update": "su {version}, è uscita la {latest}","rail.connectTitle": "Collega {name}","rail.connectLede": "Ha già effettuato l'accesso con il tuo account. Aprici una finestra di abbinamento, poi incolla qui il link che mostra.",+ "rail.hide": "Nascondi i tuoi computer",+ "rail.show": "Mostra i tuoi computer",+ "rail.showSub": "Un cerchio per ogni posto in cui vivono i tuoi bot, sul bordo sinistro della finestra.","placeLook.title": "Colore","placeLook.sub": "{name} appare in questo colore in cima alla barra laterale e nel suo cerchio sul bordo sinistro della finestra.","placeLook.aria": "Colore di {name}",diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex c509d2ebfb..ebc852cd9c 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -322,6 +322,9 @@"rail.update": "{version} を実行中、{latest} が公開されています","rail.connectTitle": "{name} を接続","rail.connectLede": "すでにあなたのアカウントでサインインしています。そこでペアリング画面を開き、表示されたリンクをここに貼り付けてください。",+ "rail.hide": "コンピューターを非表示",+ "rail.show": "コンピューターを表示",+ "rail.showSub": "ウィンドウの左端に、ボットの居場所ごとの円を表示します。","placeLook.title": "色","placeLook.sub": "{name} は、サイドバーの上部とウィンドウ左端の丸にこの色で表示されます。","placeLook.aria": "{name} の色",diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex 5c2e2c0bcb..28ecbbc9cf 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -322,6 +322,9 @@"rail.update": "na {version}, dostępna jest {latest}","rail.connectTitle": "Połącz {name}","rail.connectLede": "Jest już zalogowany na Twoje konto. Otwórz na nim okno parowania, a potem wklej tutaj link, który wyświetli.",+ "rail.hide": "Ukryj swoje komputery",+ "rail.show": "Pokaż swoje komputery",+ "rail.showSub": "Kółko dla każdego miejsca, w którym mieszkają twoje boty, przy lewej krawędzi okna.","placeLook.title": "Kolor","placeLook.sub": "{name} ma ten kolor na górze paska bocznego i w swoim kółku przy lewej krawędzi okna.","placeLook.aria": "Kolor: {name}",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex f32b110092..9b24841f97 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -312,6 +312,9 @@"rail.update": "na {version}, a {latest} já saiu","rail.connectTitle": "Conectar {name}","rail.connectLede": "Ele já está conectado à sua conta. Abra uma janela de pareamento nele e cole aqui o link que ele mostrar.",+ "rail.hide": "Ocultar seus computadores",+ "rail.show": "Mostrar seus computadores",+ "rail.showSub": "Um círculo para cada lugar onde seus bots vivem, na borda esquerda da janela.","placeLook.title": "Cor","placeLook.sub": "{name} aparece nesta cor no topo da barra lateral e no círculo dele na borda esquerda da janela.","placeLook.aria": "Cor de {name}",diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex 12bf20a106..e8920d0f01 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -322,6 +322,9 @@"rail.update": "версия {version}, вышла {latest}","rail.connectTitle": "Подключить {name}","rail.connectLede": "Он уже вошёл в ваш аккаунт. Откройте на нём окно сопряжения и вставьте сюда ссылку, которую он выведет.",+ "rail.hide": "Скрыть ваши компьютеры",+ "rail.show": "Показать ваши компьютеры",+ "rail.showSub": "Кружок для каждого места, где живут ваши боты, у левого края окна.","placeLook.title": "Цвет","placeLook.sub": "{name} отображается этим цветом вверху боковой панели и в своём кружке у левого края окна.","placeLook.aria": "Цвет: {name}",diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex a620a45e42..a1e3da9dc0 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -5004,6 +5004,9 @@"rail.update": "{version} sürümünde, {latest} çıktı","rail.connectTitle": "Bağla: {name}","rail.connectLede": "Hesabınızla zaten oturum açmış durumda. Üzerinde bir eşleştirme penceresi açın, sonra yazdırdığı bağlantıyı buraya yapıştırın.",+ "rail.hide": "Bilgisayarlarınızı gizleyin",+ "rail.show": "Bilgisayarlarınızı gösterin",+ "rail.showSub": "Botlarınızın yaşadığı her yer için pencerenin sol kenarında bir daire.","placeLook.title": "Renk","placeLook.sub": "{name}, kenar çubuğunun üstünde ve pencerenin sol kenarındaki dairesinde bu renkte görünür.","placeLook.aria": "{name} rengi",diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex 95722d6897..b7a32cc006 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -2977,6 +2977,9 @@"rail.update": "версія {version}, вийшла {latest}","rail.connectTitle": "Під’єднати {name}","rail.connectLede": "Він уже ввійшов у ваш обліковий запис. Відкрийте на ньому вікно прив'язки й вставте сюди посилання, яке він виведе.",+ "rail.hide": "Сховати ваші комп'ютери",+ "rail.show": "Показати ваші комп'ютери",+ "rail.showSub": "Кружечок для кожного місця, де живуть ваші боти, біля лівого краю вікна.","placeLook.title": "Колір","placeLook.sub": "{name} показується цим кольором угорі бічної панелі та у своєму кружечку біля лівого краю вікна.","placeLook.aria": "Колір: {name}",diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex 086099b850..c3fab82be3 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -5004,6 +5004,9 @@"rail.update": "đang ở {version}, đã có {latest}","rail.connectTitle": "Kết nối {name}","rail.connectLede": "Nó đã đăng nhập bằng tài khoản của bạn. Hãy mở cửa sổ ghép nối trên đó, rồi dán liên kết nó in ra vào đây.",+ "rail.hide": "Ẩn các máy tính của bạn",+ "rail.show": "Hiện các máy tính của bạn",+ "rail.showSub": "Một vòng tròn cho mỗi nơi các bot của bạn sống, ở mép trái cửa sổ.","placeLook.title": "Màu","placeLook.sub": "{name} hiện màu này ở đầu thanh bên và trên vòng tròn của nó ở cạnh trái cửa sổ.","placeLook.aria": "Màu của {name}",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex d817b02e07..e10b069730 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -4387,6 +4387,9 @@"rail.update": "目前是 {version},{latest} 已推出","rail.connectTitle": "連線 {name}","rail.connectLede": "它已經用你的帳號登入。在它上面開啟配對視窗,再把它顯示的連結貼到這裡。",+ "rail.hide": "隱藏你的電腦",+ "rail.show": "顯示你的電腦",+ "rail.showSub": "在視窗左側邊緣,為你的機器人所在的每個地方顯示一個圓圈。","placeLook.title": "顏色","placeLook.sub": "{name} 會以這個顏色顯示在側邊欄頂端,以及視窗左側它的圓圈上。","placeLook.aria": "{name} 的顏色",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex 078674d1ac..e65fb15814 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -3396,6 +3396,9 @@"rail.update": "当前为 {version},{latest} 已发布","rail.connectTitle": "连接 {name}","rail.connectLede": "它已经用你的账号登录。在它上面打开配对窗口,再把它显示的链接粘贴到这里。",+ "rail.hide": "隐藏你的电脑",+ "rail.show": "显示你的电脑",+ "rail.showSub": "在窗口左边缘,为你的机器人所在的每个地方显示一个圆圈。","placeLook.title": "颜色","placeLook.sub": "{name} 会以这个颜色显示在侧边栏顶部,以及窗口左侧它的圆圈上。","placeLook.aria": "{name} 的颜色",diff --git a/src/main.tsx b/src/main.tsxindex 15a20c7b99..90f3ef816d 100644--- a/src/main.tsx+++ b/src/main.tsx@@ -24,7 +24,7 @@ async function chooseRoot(): Promise<React.ReactNode> {const home = window.ogb?.home;if (location.pathname === "/home" && home) return <HomeScreen bridge={home} manage={window.ogb?.cloudPlan?.manage} />;// The window's own rail of places (electron/chrome-rail.mjs): see-through but for the rail and its open sheets.- if (location.pathname === "/rail" && window.ogb?.rail) {+ if (location.pathname === "/rail" && window.ogb?.rail?.expand) {document.documentElement.style.background = document.body.style.background = "transparent";const { ChromeRail } = await import("./components/ChromeRail");return <ChromeRail />;diff --git a/src/types/ogb.d.ts b/src/types/ogb.d.tsindex 2d6f0ce156..a7272e5c85 100644--- a/src/types/ogb.d.ts+++ b/src/types/ogb.d.ts@@ -143,9 +143,9 @@ const __APP_VERSION__: string;cancel(): Promise<void>;onState(callback: (state: CompanyBackupState) => void): () => void;};- /** The window's own rail of places (its page at /rail): a sheet of its own covers the window while open; the skin- * of the page beside it comes from main. */- rail?: { expand(on: boolean): Promise<void>; onSkin(callback: (skin: string) => void): () => void };+ /** The window's own rail of places: its page at /rail (a sheet of its own covers the window while open; the skin of+ * the page beside it comes from main), and the button on the page beside it that hides and shows it. */+ rail?: import("../../electron/chrome-rail.mjs").ChromeRailBridge;workspaces?: {/** `color`: a saved server's colour name (its owner chose it while setting the Cloud up); `home`: this window's* home is this Cloud, so there is nothing to switch to. */