Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Window frame: a thin top bar, a thinner rail, and the app in a rounded card
aivsomkar18a81845bf65
diff --git a/electron/chrome-rail.mjs b/electron/chrome-rail.mjsindex b09561a4ee..3187c4c13b 100644--- a/electron/chrome-rail.mjs+++ b/electron/chrome-rail.mjs@@ -11,7 +11,7 @@// 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_WIDTH = 36;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;diff --git a/electron/chrome-rail.node-test.mjs b/electron/chrome-rail.node-test.mjsindex 0a0b84a005..1740cd9117 100644--- a/electron/chrome-rail.node-test.mjs+++ b/electron/chrome-rail.node-test.mjs@@ -240,10 +240,10 @@ test("every page beside the rail, from any server, moves over by the rail's widtconst 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; --rail-beside: 64px;/, "and the page can read how far it moved");+ assert.match(page.head.children[0].textContent, /padding-left: 36px !important; --rail-beside: 36px;/, "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; --rail-beside: 51\.2px;/, "zoomed in, the same 64 points on screen");+ assert.match(page.head.children[0].textContent, /padding-left: 28\.8px !important; --rail-beside: 28\.8px;/, "zoomed in, the same 36 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);diff --git a/electron/window-chrome.mjs b/electron/window-chrome.mjsindex 34e91b19b1..45796c7cc5 100644--- a/electron/window-chrome.mjs+++ b/electron/window-chrome.mjs@@ -5,9 +5,10 @@ export function windowBackground(prefersDark) {return prefersDark ? "#121212" : "#fcfcfc";}+/** macOS: the traffic lights (14px) centred in the page's 28px top bar (src/components/WindowFrameBar.tsx), 12px in. */export function windowChromeOptions(platform) {if (platform === "darwin") {- return { titleBarStyle: "hiddenInset", trafficLightPosition: { x: 16, y: 16 } };+ return { titleBarStyle: "hiddenInset", trafficLightPosition: { x: 12, y: 7 } };}if (platform === "win32") {return { titleBarStyle: "hidden" };diff --git a/electron/window-chrome.test.mjs b/electron/window-chrome.test.mjsindex 8d2f9dc00b..1c67e16433 100644--- a/electron/window-chrome.test.mjs+++ b/electron/window-chrome.test.mjs@@ -6,7 +6,7 @@ describe("window chrome", () => {it("uses inset traffic lights on macOS", () => {expect(windowChromeOptions("darwin")).toEqual({titleBarStyle: "hiddenInset",- trafficLightPosition: { x: 16, y: 16 },+ trafficLightPosition: { x: 12, y: 7 },});});diff --git a/src/App.tsx b/src/App.tsxindex 447f030063..6e965e2e15 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -39,8 +39,10 @@ import { InboxPanel } from "@/components/inbox/InboxPanel";import { CloudAddDialog } from "@/components/CloudAddDialog";import { PlacesRail } from "@/components/PlacesRail";import { CloudHowTo } from "@/components/CloudHowTo";-import { DesktopCapabilitiesProvider, useCaptionChrome, useDesktopCapabilities, WindowDragStrip } from "@/components/DesktopCapabilities";+import { DesktopCapabilitiesProvider, useCaptionChrome, useDesktopCapabilities, WindowDragStrip, windowFramed } from "@/components/DesktopCapabilities";import { WindowCaptionButtons } from "@/components/WindowCaptionButtons";+import { WindowFrameBar } from "@/components/WindowFrameBar";+import { cn } from "@/lib/cn";import { NoEngines } from "@/components/NoEngines";import { CloudEngineSignIn } from "@/components/CloudEngineSignIn";import { CloudIntent } from "@/components/CloudIntent";@@ -302,9 +304,15 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {});}, [dispatch]);+ const framed = windowFramed(capabilities.windowChrome);return (- <div className="flex h-full flex-col">- <UpdateBanner sidebarIndicator={!calendarFocus && (sidebarInline || drawerOpen)} />+ <div className={cn("flex h-full flex-col", framed && "bg-frame")}>+ <WindowFrameBar />+ {/* A framed window shows the app in a rounded card under its top bar, beside the window's rail: the corners that+ meet the frame are round, and the card runs to the window's right and bottom edges. */}+ <div data-window-card={framed ? "" : undefined}+ className={framed ? "relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-t-[12px] rounded-bl-[12px] bg-app ring-1 ring-ink/[0.06]" : "contents"}>+ <UpdateBanner sidebarIndicator={framed || (!calendarFocus && (sidebarInline || drawerOpen))} /><CloudAsleepStrip /><LiveConnectionStrip connected={state.connected} hydrated={state.hydrated === true} /><CloudSendStrip cloudHome={state.config?.cloudHome === true} />@@ -427,6 +435,7 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {className="pointer-events-none absolute left-3 top-3 size-[30px] md:hidden"/>}</div>+ </div>{/* Last child on purpose: Blink resolves -webkit-app-region in DOM order, so no-drag buttons must follow every drag region. */}<WindowCaptionButtonsvisible={capabilities.windowChrome === "win-caption" && Boolean(window.ogb?.windowControls)}diff --git a/src/components/ActivityPanel.tsx b/src/components/ActivityPanel.tsxindex 84fb76212f..f4f947fadd 100644--- a/src/components/ActivityPanel.tsx+++ b/src/components/ActivityPanel.tsx@@ -25,7 +25,7 @@ const TONE_CLASS: Record<ChipTone, string> = {export function ActivityPanel({ bot }: { bot: Bot }) {const { dispatch } = useStore();- const { padClass, dragProps } = useCaptionChrome();+ const { dragProps } = useCaptionChrome();const [rows, setRows] = useState<ActivityRow[] | null>(null);const [error, setError] = useState<string | null>(null);const loadAbort = useRef<AbortController | null>(null);@@ -100,7 +100,7 @@ export function ActivityPanel({ bot }: { bot: Bot }) {return (<aside aria-label={t("activity.panel.aria", { name: bot.name })} className="animate-panel-in flex h-full w-[400px] max-w-full shrink-0 flex-col border-l border-hairline/40 bg-panel max-md:absolute max-md:inset-y-0 max-md:right-0 max-md:z-30">- <div {...dragProps} className={cn("flex items-center justify-between px-4 py-3", padClass)}>+ <div {...dragProps} className="flex items-center justify-between px-4 py-3"><span className="flex items-center gap-2 text-[15px] font-semibold text-ink"><ListChecks size={16} className="text-ink-secondary" /> {t("activity.panel.title")}</span>diff --git a/src/components/BotSettingsDialog.caption.test.ts b/src/components/BotSettingsDialog.caption.test.tsindex e6d54c3016..82324f17f4 100644--- a/src/components/BotSettingsDialog.caption.test.ts+++ b/src/components/BotSettingsDialog.caption.test.ts@@ -27,13 +27,9 @@ const header = () => headerTag().match(/class="([^"]*)"/)?.[1] ?? "";afterEach(() => vi.unstubAllGlobals());describe("bot settings caption inset", () => {- it("drops the close button below the Windows caption buttons", () => {- vi.stubGlobal("window", { ogb: { platform: "win32" } });- expect(header()).toContain("pt-[28px]");- });-- it("keeps the header flush elsewhere", () => {- vi.stubGlobal("window", { ogb: { platform: "darwin" } });+ // The window frame's top bar holds the caption buttons and the traffic lights, above the app's card.+ it.each(["win32", "darwin"] as const)("keeps the header flush on %s: the frame's top bar holds the window's buttons", (platform) => {+ vi.stubGlobal("window", { ogb: { platform } });const classes = header();expect(classes).toContain("py-3");expect(classes).not.toContain("pt-[28px]");diff --git a/src/components/BotSettingsDialog.tsx b/src/components/BotSettingsDialog.tsxindex 7bb0e082e3..d8030be674 100644--- a/src/components/BotSettingsDialog.tsx+++ b/src/components/BotSettingsDialog.tsx@@ -43,7 +43,7 @@ export function BotSettingsDialog({ bot, overlay = false }: {const section = state.botSettingsSection;const derived = useBotSettingsDerived(bot);const dialogRef = useRef<HTMLElement | null>(null);- const { padClass, dragProps } = useCaptionChrome();+ const { dragProps } = useCaptionChrome();const [query, setQuery] = useState("");const collapsed = !state.botSettingsExpandAccordion;const q = query.trim().toLowerCase();@@ -174,12 +174,11 @@ export function BotSettingsDialog({ bot, overlay = false }: {<BotPanelbot={bot}derived={derived}- headerClassName={padClass}linkedSection={linkedSection}onClose={() => dispatch({ type: "toggleSettings", open: false })}/>) : <>- <div {...dragProps} className={cn("flex shrink-0 items-center justify-between px-4 py-3", padClass)}>+ <div {...dragProps} className="flex shrink-0 items-center justify-between px-4 py-3"><span id="bot-settings-title" className="truncate text-[15px] font-semibold text-ink">{bot.name}</span>diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsxindex dcd7824691..d0450c18db 100644--- a/src/components/ChatView.tsx+++ b/src/components/ChatView.tsx@@ -822,7 +822,7 @@ export function ChatView({ bot: profile }: { bot: Bot }) {const { state, dispatch } = useStore();const showThreads = useShowThreads();const remoteClient = window.ogb?.remoteClient?.active === true;- const { dragProps: headerDragProps, noDragStyle: headerNoDragStyle, controlsShiftStyle } = useCaptionChrome();+ const { dragProps: headerDragProps, noDragStyle: headerNoDragStyle } = useCaptionChrome();const composerDockRef = useRef<HTMLDivElement>(null);const composerDock = useComposerDockPad(composerDockRef);const advanced = useAdvancedMode();@@ -1098,7 +1098,6 @@ export function ChatView({ bot: profile }: { bot: Bot }) {<divdata-chathead-controlsclassName={cn("flex shrink-0 items-center gap-2", !phone && "@max-[30rem]/chathead:ml-auto @max-[30rem]/chathead:flex-wrap @max-[30rem]/chathead:justify-end @min-[30rem]/chathead:col-start-3 @min-[30rem]/chathead:justify-self-end")}- style={controlsShiftStyle}>{!simpleHead && (bot.busy || bot.waitingForTeammates) && (<buttondiff --git a/src/components/ChromeRailToggle.tsx b/src/components/ChromeRailToggle.tsxindex 632e2e294c..2cc19a005e 100644--- a/src/components/ChromeRailToggle.tsx+++ b/src/components/ChromeRailToggle.tsx@@ -16,17 +16,18 @@ export function RailStripIcon({ size }: { size: number }) {</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 }) {+/** The button that hides and shows the window's rail of places, while this window has one: in the window frame's top+ * bar (`bar`: that bar's button look), or else in the sidebar's top row, in the look of its other buttons: Simple's,+ * Advanced's, or Advanced's column when the sidebar shows only avatars. */+export function ChromeRailToggle({ advanced = false, icons = false, bar, style }: { advanced?: boolean; icons?: boolean; bar?: string; 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} />+ className={bar ?? (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={bar ? 15 : advanced && icons ? 20 : 18} /></button>;}diff --git a/src/components/ComputerPanel.tsx b/src/components/ComputerPanel.tsxindex 61fc730be6..dc813977fe 100644--- a/src/components/ComputerPanel.tsx+++ b/src/components/ComputerPanel.tsx@@ -129,7 +129,7 @@ export function ComputerPanel({bot: Bot;onOpenVmWorkspace?: (botId: string) => void;}) {- const { padClass, dragProps } = useCaptionChrome();+ const { dragProps } = useCaptionChrome();const { panelWidth, separatorRef, separatorWidth, onSeparatorKeyDown, onResizeStart, onResizeMove, onResizeEnd } = useComputerPanelResize();const { state, dispatch, flushBotPatches } = useStore();const liveTask = profileBot.tasks?.find((task) => task.threadId === profileBot.threadId);@@ -1215,7 +1215,7 @@ export function ComputerPanel({className="absolute inset-y-0 left-0 z-10 w-1.5 cursor-col-resize hover:bg-accent/40 focus-visible:bg-accent/60 max-md:hidden"/>{/* ml-1.5 keeps the drag region clear of the resize handle: a later drag region in the DOM wins. */}- <div {...dragProps} className={cn("@container/paneltabs ml-1.5 py-3 pl-2.5 pr-4", padClass)}>+ <div {...dragProps} className="@container/paneltabs ml-1.5 py-3 pl-2.5 pr-4"><div className="relative flex min-h-7 items-center justify-center">{advanced && (<buttondiff --git a/src/components/DesktopCapabilities.tsx b/src/components/DesktopCapabilities.tsxindex 8b006bc69e..398b86c376 100644--- a/src/components/DesktopCapabilities.tsx+++ b/src/components/DesktopCapabilities.tsx@@ -59,9 +59,16 @@ const NO_DRAG_STYLE = { WebkitAppRegion: "no-drag" } as CSSProperties;export type WindowDragProps = { "data-window-drag"?: ""; style?: CSSProperties };+/** A window that draws its own frame: the top bar holding the traffic lights or the Windows caption buttons+ * (WindowFrameBar), the rail of places, and the app in a rounded card beside them. Nothing under the bar makes room+ * for the window's buttons. */+export function windowFramed(windowChrome: DesktopCapabilities["windowChrome"] | undefined): boolean {+ return windowChrome === "mac-inset" || windowChrome === "win-caption";+}+export function captionChrome(windowChrome: DesktopCapabilities["windowChrome"] | undefined) {const windowsCaption = windowChrome === "win-caption";- const draggable = windowsCaption || windowChrome === "mac-inset";+ const draggable = windowFramed(windowChrome);const dragProps: WindowDragProps = draggable ? { "data-window-drag": "", style: DRAG_STYLE } : {};return {windowsCaption,@@ -69,13 +76,6 @@ export function captionChrome(windowChrome: DesktopCapabilities["windowChrome"]dragProps,dragStyle: draggable ? DRAG_STYLE : undefined,noDragStyle: draggable ? NO_DRAG_STYLE : undefined,- // Margins, not a transform: Blink resolves -webkit-app-region from untransformed layout boxes, so translateY would- // leave dead clicks in the drag region.- controlsShiftStyle: windowsCaption- ? ({ WebkitAppRegion: "no-drag", marginTop: "16px", marginBottom: "-16px" } as CSSProperties)- : undefined,- // tailwind-merge in cn() lets this override only the pt half of py-*.- padClass: windowsCaption ? "pt-[28px]" : undefined,};}diff --git a/src/components/InspectorPanel.tsx b/src/components/InspectorPanel.tsxindex 171350d4dc..b12896556b 100644--- a/src/components/InspectorPanel.tsx+++ b/src/components/InspectorPanel.tsx@@ -14,7 +14,7 @@ type Lens = "run" | "events" | "raw";export function InspectorPanel({ bot }: { bot: Bot }) {const { dispatch } = useStore();- const { padClass, dragProps } = useCaptionChrome();+ const { dragProps } = useCaptionChrome();const threadId = bot.threadId;const [lens, setLens] = useState<Lens>("run");const activity = useMemo(() => timelineEvents(visibleMessages(bot), bot), [bot]);@@ -144,7 +144,7 @@ export function InspectorPanel({ bot }: { bot: Bot }) {return (<aside aria-label="Inspector" className="animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel md:static md:z-auto md:w-[min(460px,45vw)] md:shrink-0">- <div {...dragProps} className={cn("flex items-center justify-between px-4 py-3", padClass)}>+ <div {...dragProps} className="flex items-center justify-between px-4 py-3"><span className="flex items-center gap-2 text-[15px] font-semibold text-ink"><Bug size={16} className="text-ink-secondary" /> Inspector</span>diff --git a/src/components/LiveDesktop.tsx b/src/components/LiveDesktop.tsxindex e42313fad3..4859bb29ec 100644--- a/src/components/LiveDesktop.tsx+++ b/src/components/LiveDesktop.tsx@@ -28,7 +28,7 @@ export function LiveDesktop({ target, threadId, name, poster, expanded, onExpandconst [attempt, setAttempt] = useState(0);const [text, setText] = useState("");const live = useRef(false);- const { dragProps, noDragStyle, padClass } = useCaptionChrome();+ const { dragProps, noDragStyle } = useCaptionChrome();const macInset = useDesktopCapabilities().capabilities.windowChrome === "mac-inset";const unreachable = useRef(onUnreachable);unreachable.current = onUnreachable;@@ -90,7 +90,7 @@ export function LiveDesktop({ target, threadId, name, poster, expanded, onExpand}}>{expanded && (- <header {...dragProps} className={cn("flex shrink-0 flex-wrap items-center gap-2 border-b border-hairline/40 bg-panel px-3 py-2", macInset && "pl-[86px]", padClass)}>+ <header {...dragProps} className={cn("flex shrink-0 flex-wrap items-center gap-2 border-b border-hairline/40 bg-panel px-3 py-2", macInset && "pl-[86px]")}><span className="min-w-0 truncate text-[13px] font-medium text-ink">{label}</span>{pill}<formdiff --git a/src/components/PlacesRail.test.ts b/src/components/PlacesRail.test.tsindex 799dd5c510..6ead2fac4e 100644--- a/src/components/PlacesRail.test.ts+++ b/src/components/PlacesRail.test.ts@@ -296,17 +296,18 @@ 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, small circles named on hover, and its sheets cover the window while open", async () => {+it("the window's own rail: drawn at every width, 36px wide with small rounded tiles 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, "as thin as its tiles allow, in the frame's colour").toContain("w-9 shrink-0 flex-col items-center bg-frame");expect(nav.className, "never hidden on a narrow window").not.toContain("hidden");- expect(nav.textContent, "no name under the place on screen: its circle's ring marks it").toBe("MCCAACBCCO");+ expect(nav.textContent, "no name under the place on screen: its tile'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(host.querySelector('[data-rail-place="home"] span')?.getAttribute("style")).toContain("width: 24px; height: 24px; border-radius: 7px");+ expect(host.querySelector("[data-rail-add]")?.className).toContain("size-6 place-items-center rounded-[7px]");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 b10161d396..3fb49ee988 100644--- a/src/components/PlacesRail.tsx+++ b/src/components/PlacesRail.tsx@@ -1,6 +1,6 @@-// The rail at the window's left edge once a person has two places or more: one circle per Cloud, team's Cloud or server,+// The rail at the window's left edge once a person has two places or more: one tile per Cloud, team's Cloud or server,// the place on screen marked, ⋯ for the rest past eight, + last. Main lists the places and opens one by its id; the rail-// never names an address. A right-click on a circle (or its row past eight) opens that place's menu: its colour, changed+// never names an address. A right-click on a tile (or its row past eight) opens that place's menu: its colour, changed// here for every place whatever its server runs, and Remove from list for a Cloud of the person's own that ended or was// never paid for (asked first; main takes it off their list on the Admin).import { useEffect, useRef, useState, type CSSProperties, type MouseEvent as ReactMouseEvent } from "react";@@ -14,16 +14,19 @@ import { activeLocale, t } from "@/lib/i18n";import { localizedRelativeTime } from "@/lib/memory";import { useAdvancedMode } from "@/lib/interface-mode";import { placeInitials, recolorPlace, removePlace, usePlaces, type RailPlace } from "@/lib/places";-import { useDesktopCapabilities } from "./DesktopCapabilities";+import { useDesktopCapabilities, windowFramed } from "./DesktopCapabilities";import { MENU_ROW, MENU_SHEET } from "./menu-recipe";import { PlaceAddSheet } from "./PlaceAddSheet";import { SwatchRadios } from "./SwatchRadios";-/** Circles before ⋯ opens the searchable list of every place. */+/** Tiles before ⋯ opens the searchable list of every place. */export const RAIL_SHOWN = 8;-const CIRCLE = 32;+/** A place's tile on the rail: a small rounded square, so the rail stays as thin as it can (36px). */+const TILE = 24;+/** A place's mark at any size: a rounded square, its corners in step with its size. */+const tileRadius = (size: number) => Math.round(size * 0.3);-/** 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+/** A tile'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* reachable on its own network. */export function placeLabel(place: RailPlace, now = Date.now()): string {@@ -38,11 +41,11 @@ export function placeLabel(place: RailPlace, now = Date.now()): string {return [status, place.update && t("rail.update", place.update), place.ownNetwork && t("rail.ownNetwork")].filter(Boolean).join(" · ");}-/** Whether a circle does anything: opens its place, or, for a server of the person's own not connected yet, shows how+/** Whether a tile does anything: opens its place, or, for a server of the person's own not connected yet, shows how* to connect it (only where a pairing link can be pasted). */export const placeActs = (place: RailPlace, canPair: boolean): boolean => place.opens || (place.pairs === true && canPair);-/** The circles before ⋯: every place up to RAIL_SHOWN; past that the first ones, with the place on screen always among them. */+/** The tiles before ⋯: every place up to RAIL_SHOWN; past that the first ones, with the place on screen always among them. */export function shownPlaces(places: RailPlace[], limit = RAIL_SHOWN): RailPlace[] {if (places.length <= limit) return places;const first = places.slice(0, limit - 1), active = places.find((place) => place.active);@@ -58,27 +61,32 @@ export function matchingPlaces(places: RailPlace[], query: string): RailPlace[]});}+/** The tile's progress, drawn round its edge. The line starts at the top edge's middle and runs clockwise. */function ProgressRing({ value = 0, waiting = false }: { value?: number; waiting?: boolean }) {- const box = CIRCLE + 8, radius = box / 2 - 1.5, around = 2 * Math.PI * radius;+ const box = TILE + 6, inset = 1, side = box - 2 * inset, corner = tileRadius(TILE) + 2;+ const around = 4 * (side - 2 * corner) + 2 * Math.PI * corner;const shown = waiting ? 0.28 : Math.max(0.06, Math.min(1, value));+ const edge = `M ${box / 2} ${inset} H ${box - inset - corner} A ${corner} ${corner} 0 0 1 ${box - inset} ${inset + corner} V ${box - inset - corner}`+ + ` A ${corner} ${corner} 0 0 1 ${box - inset - corner} ${box - inset} H ${inset + corner} A ${corner} ${corner} 0 0 1 ${inset} ${box - inset - corner}`+ + ` V ${inset + corner} A ${corner} ${corner} 0 0 1 ${inset + corner} ${inset} Z`;return <svg aria-hidden="true" data-rail-ring={waiting ? "waiting" : Math.round(value * 100)} width={box} height={box} viewBox={`0 0 ${box} ${box}`}- className={cn("pointer-events-none absolute -left-1 -top-1 -rotate-90", waiting && "animate-spin [animation-duration:2.4s] motion-reduce:animate-none")}>- <circle cx={box / 2} cy={box / 2} r={radius} fill="none" stroke="var(--color-hairline)" strokeWidth={2} />- <circle cx={box / 2} cy={box / 2} r={radius} fill="none" stroke="var(--color-accent)" strokeWidth={2} strokeLinecap="round" strokeDasharray={`${shown * around} ${around}`}+ className={cn("pointer-events-none absolute -left-[3px] -top-[3px]", waiting && "animate-pulse motion-reduce:animate-none")}>+ <path d={edge} fill="none" stroke="var(--color-hairline)" strokeWidth={1.5} />+ <path d={edge} fill="none" stroke="var(--color-accent)" strokeWidth={1.5} strokeLinecap="round" strokeDasharray={`${shown * around} ${around}`}className="transition-[stroke-dasharray] duration-500 motion-reduce:transition-none" /></svg>;}-export function PlaceMark({ place, size = CIRCLE }: { place: RailPlace; size?: number }) {+export function PlaceMark({ place, size = TILE }: { place: RailPlace; size?: number }) {const color = cloudColor(place.color);return <span aria-hidden="true" data-rail-offline={place.offline ? "" : undefined} data-rail-ended={place.ended ? "" : undefined}- className={cn("grid shrink-0 place-items-center rounded-full font-semibold leading-none", color ? "text-white" : "bg-raised text-ink", (place.offline || place.ended) && "opacity-55 grayscale")}- style={{ width: size, height: size, fontSize: Math.round(size * 0.36), ...(color ? { background: cloudColorFill(color) } : {}) }}>+ className={cn("grid shrink-0 place-items-center font-semibold leading-none", color ? "text-white" : "bg-card text-ink", (place.offline || place.ended) && "opacity-55 grayscale")}+ style={{ width: size, height: size, borderRadius: tileRadius(size), fontSize: Math.round(size * 0.4), ...(color ? { background: cloudColorFill(color) } : {}) }}>{place.kind === "computer" ? <Laptop size={Math.round(size * 0.46)} strokeWidth={1.75} /> : placeInitials(place.name)}</span>;}-/** A place's menu opens where it was asked for: beside its circle, or its row past eight. */+/** A place's menu opens where it was asked for: beside its tile, or its row past eight. */type MenuAt = { place: RailPlace; from: HTMLElement };/** The right-click (or the keyboard's menu key) on a place with a colour to show, or one to remove from the list, opens its* menu; elsewhere, nothing. */@@ -96,25 +104,25 @@ export function topWithin(element: HTMLElement, rail: HTMLElement): number {return top;}-function PlaceCircle({ place, calm, canPair, onOpen, onMenu }: { place: RailPlace; calm: boolean; canPair: boolean; onOpen: (place: RailPlace) => void; onMenu: (at: MenuAt) => void }) {+function PlaceTile({ place, calm, canPair, onOpen, onMenu }: { place: RailPlace; calm: boolean; canPair: boolean; onOpen: (place: RailPlace) => void; onMenu: (at: MenuAt) => void }) {const label = placeLabel(place), acts = placeActs(place, canPair);return <button type="button" aria-label={label} title={label} aria-current={place.active ? "page" : undefined} aria-disabled={acts ? undefined : true}data-rail-place={place.id} data-rail-kind={place.kind} onClick={() => { if (acts && !place.active) onOpen(place); }} onContextMenu={menuOpener(place, onMenu)}- className={cn("relative shrink-0 rounded-full transition-[box-shadow,opacity] duration-150 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-focus",- place.active ? cn("ring-2 ring-offset-2 ring-offset-panel", calm ? "ring-ink/45" : "ring-ink/75")- : acts ? "hover:ring-2 hover:ring-ink/15 hover:ring-offset-2 hover:ring-offset-panel" : cn("cursor-default", !place.offline && "opacity-75"))}>+ className={cn("relative shrink-0 rounded-[7px] transition-[box-shadow,opacity] duration-150 focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-focus",+ place.active ? cn("ring-[1.5px] ring-offset-[1.5px] ring-offset-frame", calm ? "ring-ink/45" : "ring-ink/75")+ : acts ? "hover:ring-[1.5px] hover:ring-ink/15 hover:ring-offset-[1.5px] hover:ring-offset-frame" : 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-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} />+ {place.attention && <span aria-hidden="true" data-rail-dot className="absolute -right-1 -top-1 size-2.5 rounded-full border-2 border-frame bg-danger" />}+ {place.update && !place.attention && <span aria-hidden="true" data-rail-update className="absolute -right-1 -top-1 size-2.5 rounded-full border-2 border-frame bg-accent" />}+ {place.server && <span aria-hidden="true" data-rail-server className="absolute -bottom-1 -right-1 grid size-3 place-items-center rounded-full border border-hairline bg-frame text-ink-secondary">+ <Server size={7} strokeWidth={2.25} /></span>}</button>;}/** Remove from list in a place's menu: asked first, in plain words; once main took it off the list, the menu closes and the- * circle goes with main's next list. */+ * tile goes with main's next list. */function RemoveRow({ place, onRemoved }: { place: RailPlace; onRemoved: () => void }) {const [asking, setAsking] = useState(false);const [busy, setBusy] = useState(false);@@ -233,37 +241,37 @@ export function PlacesRail({ chrome = false }: { chrome?: boolean }) {track("rail_place_opened", { kind: place.kind });void bridge?.open?.(place.id).catch(() => {});};- const macInset = capabilities.windowChrome === "mac-inset";- const draggable = macInset || capabilities.windowChrome === "win-caption";+ const framed = windowFramed(capabilities.windowChrome), draggable = framed;// SAFETY: Electron's -webkit-app-region is not in React's CSSProperties type; the renderer accepts it as an inline style.const drag = draggable ? ({ WebkitAppRegion: "drag" } as CSSProperties) : undefined;const noDrag = draggable ? ({ WebkitAppRegion: "no-drag" } as CSSProperties) : undefined;const shown = shownPlaces(state.places);const canPair = state.add.link || state.add.address, canAdd = state.add.cloud || canPair || state.add.organization === true;- // The menu opens next to the circle or row it was asked from (measured now, while that row is there), within the rail.+ // The menu opens next to the tile or row it was asked from (measured now, while that row is there), within the rail.const openMenu = ({ place, from }: MenuAt) => {const nav = navRef.current;setMenu({ place, top: nav ? Math.max(8, Math.min(topWithin(from, nav) - 6, nav.clientHeight - 200)) : 8 });};return <nav ref={navRef} aria-label={t("rail.label")} data-places-rail style={drag}- 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 overflow-y-auto px-1 py-1" style={noDrag}>+ className={cn("relative w-9 shrink-0 flex-col items-center bg-frame", chrome ? "flex h-full" : "hidden md:flex", !framed && (calm ? "border-r border-ink/[0.04]" : "border-r border-hairline/50"))}>+ {/* In a framed window the rail is part of the frame: the window's own rail runs the full height, its top in the+ frame's top bar (the traffic lights' place), so its places start under that bar. */}+ <div aria-hidden="true" className={!framed ? "h-3 shrink-0" : chrome ? "h-[37px] shrink-0" : "h-[9px] shrink-0"} />+ <ul className="flex min-h-0 flex-col items-center gap-2 overflow-y-auto py-[3px]" style={noDrag}>{shown.map((place) => <li key={place.id} className="flex">- <PlaceCircle place={place} calm={calm} canPair={canPair} onOpen={open} onMenu={openMenu} />+ <PlaceTile place={place} calm={calm} canPair={canPair} onOpen={open} onMenu={openMenu} /></li>)}</ul><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-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" />+ className="grid size-6 place-items-center rounded-[7px] 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={13} 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-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" />+ className="grid size-6 place-items-center rounded-[7px] 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={13} 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/RemoteAgentSettingsPanel.tsx b/src/components/RemoteAgentSettingsPanel.tsxindex 7de6b40e6f..dc12bf82f6 100644--- a/src/components/RemoteAgentSettingsPanel.tsx+++ b/src/components/RemoteAgentSettingsPanel.tsx@@ -20,7 +20,7 @@ export function RemoteAgentSettingsPanel({ bot, overlay = false }: {overlay?: boolean;}) {const { dispatch } = useStore();- const { padClass, dragProps } = useCaptionChrome();+ const { dragProps } = useCaptionChrome();const [saving, setSaving] = useState(false);const [error, setError] = useState("");const [uploading, setUploading] = useState(false);@@ -79,7 +79,7 @@ export function RemoteAgentSettingsPanel({ bot, overlay = false }: {"animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel",overlay ? "md:left-auto md:w-[400px] md:shadow-2xl" : "md:relative md:z-20 md:w-[400px] md:shrink-0",)}>- <div {...dragProps} className={cn("flex items-center justify-between px-4 py-3", padClass)}>+ <div {...dragProps} className="flex items-center justify-between px-4 py-3"><buttononClick={close}aria-label="Collapse remote agent settings"diff --git a/src/components/RoomHeader.tsx b/src/components/RoomHeader.tsxindex beaccc3e81..9bc93ce930 100644--- a/src/components/RoomHeader.tsx+++ b/src/components/RoomHeader.tsx@@ -145,7 +145,7 @@ export function RoomHeader({onOpenMembers: () => void;membersTriggerRef: RefObject<HTMLButtonElement | null>;}) {- const { dragProps: headerDragProps, noDragStyle: headerNoDragStyle, controlsShiftStyle } = useCaptionChrome();+ const { dragProps: headerDragProps, noDragStyle: headerNoDragStyle } = useCaptionChrome();const faces = memberMauses(group, members);const membersLabel = members.length === 1? t("room.members.ariaOne")@@ -171,7 +171,7 @@ export function RoomHeader({</button>{group.description && <p className="max-w-full truncate text-[12px] leading-4 text-ink-secondary">{group.description}</p>}</div>- <div data-roomhead-controls className="flex shrink-0 items-center" style={controlsShiftStyle}>+ <div data-roomhead-controls className="flex shrink-0 items-center"><buttonref={membersTriggerRef}type="button"@@ -218,7 +218,6 @@ export function RoomHeader({<divdata-roomhead-controlsclassName="flex items-center gap-1.5 @max-3xl/roomhead:ml-auto @max-3xl/roomhead:flex-wrap @max-3xl/roomhead:justify-end"- style={controlsShiftStyle}><buttontype="button"diff --git a/src/components/Sidebar.header.test.ts b/src/components/Sidebar.header.test.tsindex 7e6a4456a6..74eacbaa23 100644--- a/src/components/Sidebar.header.test.ts+++ b/src/components/Sidebar.header.test.ts@@ -30,7 +30,7 @@ vi.mock("./DesktopCapabilities", async (importOriginal) => ({},}));-import { MAC_TRAFFIC_LIGHT_CENTER_Y, Sidebar } from "./Sidebar";+import { Sidebar } from "./Sidebar";const render = () => renderToStaticMarkup(createElement(StoreProvider, null, createElement(Sidebar, { open: true, onClose: () => {} })),@@ -109,16 +109,15 @@ describe("sidebar top row", () => {buttons: row.indexOf("data-sidebar-top-buttons"),});- it("puts the lights, a drag space, then the compact server switcher beside the buttons on one macOS row in Advanced mode", () => {+ it("leaves the traffic lights to the window frame's top bar on macOS: a drag space, then the compact server switcher beside the buttons in Advanced mode", () => {fixture.windowChrome = "mac-inset";desktop();const html = render();const row = topRow(html);- expect(MAC_TRAFFIC_LIGHT_CENTER_Y).toBe(23);- expect(row).toMatch(/^data-sidebar-top-row="true" class="[^"]*\bitems-center\b[^"]*" style="-webkit-app-region:drag;height:46px"/);+ expect(row).toMatch(/^data-sidebar-top-row="true" class="[^"]*\bitems-center\b[^"]*\bh-12\b[^"]*" style="-webkit-app-region:drag"/);const { lights, slot, spacer, switcher, buttons } = order(row);- expect(lights).toBeGreaterThan(-1);- expect(slot).toBeGreaterThan(lights);+ expect(lights).toBe(-1);+ expect(slot).toBeGreaterThan(-1);expect(spacer).toBeGreaterThan(slot);expect(switcher).toBeGreaterThan(spacer);expect(buttons).toBeGreaterThan(switcher);@@ -126,7 +125,6 @@ describe("sidebar top row", () => {const rowClasses = classesOf(row, "data-sidebar-top-row");expect(rowClasses).toEqual(expect.arrayContaining(["relative", "pl-4", "pr-2"]));expect(rowClasses).not.toContain("px-4");- expect(classesOf(row, "data-traffic-light-space")).toEqual(expect.arrayContaining(["w-[72px]", "shrink-0"]));expect(classesOf(row, "data-sidebar-top-slot")).toEqual(expect.arrayContaining(["@container/sidebar-top", "min-w-0", "flex-1"]));expect(row).toContain('<div data-sidebar-top-spacer="true" class="min-w-0 flex-1 @min-[96px]/sidebar-top:min-w-6"></div>');const switcherClasses = classesOf(row, "data-sidebar-top-switcher");@@ -143,24 +141,24 @@ describe("sidebar top row", () => {expect(html.match(/Switch server:/g)).toHaveLength(1);});- it("in Simple mode puts a round search and a round + on the right of a 60px macOS row, with no server pill, and the collapse bump on the edge until hover", () => {+ it.each(["mac-inset", "win-caption"] as const)("in Simple mode on %s keeps only the top corner: plain search and + at its right end, no drag region, no server pill, and the collapse bump on the edge until hover", (windowChrome) => {fixture.advanced = false;- fixture.windowChrome = "mac-inset";+ fixture.windowChrome = windowChrome;desktop();const html = render();const row = topRow(html);- expect(row).toMatch(/^data-sidebar-top-row="true" class="[^"]*\bh-\[60px\][^"]*\bitems-start\b[^"]*" style="-webkit-app-region:drag"/);- expect(classesOf(row, "data-sidebar-top-row")).toEqual(expect.arrayContaining(["pl-4", "pr-4", "pt-3"]));+ expect(row, "the bot tiles rise into the rest of the corner: no drag region, no clicks but the buttons'").toMatch(/^data-sidebar-top-row="corner" class="[^"]*\bpointer-events-none\b[^"]*\bh-\[34px\][^"]*\bitems-start\b[^"]*">/);+ expect(classesOf(row, "data-sidebar-top-row")).toEqual(expect.arrayContaining(["justify-end", "px-1.5", "pt-1.5"]));expect(row).not.toContain("data-workspace-switcher");expect(html).not.toContain("Switch server:");const { lights, slot, buttons } = order(row);- expect(lights).toBeGreaterThan(-1);- expect(slot).toBeGreaterThan(lights);+ expect(lights).toBe(-1);expect(buttons).toBeGreaterThan(slot);- expect(classesOf(row, "data-sidebar-top-buttons")).toEqual(expect.arrayContaining(["shrink-0", "gap-2"]));+ expect(classesOf(row, "data-sidebar-top-buttons")).toEqual(expect.arrayContaining(["shrink-0", "pointer-events-auto"]));expect(row.slice(buttons).match(/<button/g)).toHaveLength(2);- expect(row).toMatch(/data-sidebar-search-toggle="true" aria-label="Search bots and messages" aria-expanded="false" title="Search bots and messages" class="[^"]*\bsize-9\b[^"]*\brounded-full\b[^"]*\btext-ink\/90\b[^"]*\bbg-composer\b/);- expect(html).toMatch(/aria-label="New or share" class="[^"]*\bsize-9\b[^"]*\brounded-full\b/);+ expect(row).toMatch(/data-sidebar-search-toggle="true" aria-label="Search bots and messages" aria-expanded="false" title="Search bots and messages" class="[^"]*\bsize-\[26px\][^"]*\brounded-lg\b[^"]*\btext-ink-secondary\b/);+ expect(row, "no round box round either").not.toContain("bg-composer");+ expect(html).toMatch(/aria-label="New or share" class="[^"]*\bsize-\[26px\][^"]*\brounded-lg\b/);expect(html).toMatch(/data-sidebar-edge-toggle="true" aria-label="Collapse sidebar to avatars" aria-expanded="true" title="Collapse to avatars" style="-webkit-app-region:no-drag" class="[^"]*\babsolute\b[^"]*\bpointer-events-none opacity-0\b[^"]*\btouch:pointer-events-auto touch:opacity-100\b[^"]*\btop-\[14px\]/);expect(html).not.toContain('title="Active Threads"');expect(html).not.toContain("data-sidebar-search-pill");@@ -194,17 +192,16 @@ describe("sidebar top row", () => {expect(buttons).toBeGreaterThan(spacer);});- it("collapses Simple mode to a rail: the lights, then round search and + on top, the expand bump on the edge, and Apps and the account at the foot", () => {+ it("collapses Simple mode to a rail: round search and + on top (the frame's top bar holds the lights), the expand bump on the edge, and Apps and the account at the foot", () => {fixture.advanced = false;fixture.density = "icons";fixture.windowChrome = "mac-inset";desktop();const html = render();const top = html.slice(html.indexOf("data-sidebar-top-row"), html.indexOf("data-sidebar-rail-footer"));- expect(top).toContain("data-traffic-light-space");+ expect(top).not.toContain("data-traffic-light-space");expect(top).not.toContain("data-sidebar-top-buttons");expect(top).not.toContain("data-workspace-switcher");- expect(top.indexOf("data-traffic-light-space")).toBeLessThan(top.indexOf('aria-label="Search bots and messages"'));expect(top.indexOf('aria-label="Search bots and messages"')).toBeLessThan(top.indexOf('aria-label="New or share"'));expect(top).toMatch(/data-sidebar-rail-top="true" class="flex flex-col items-center gap-2 pt-1"/);expect(top).toMatch(/aria-label="New or share" class="[^"]*\bsize-9\b[^"]*\brounded-full\b/);@@ -239,7 +236,7 @@ describe("sidebar top row", () => {expect(row).not.toContain("data-workspace-switcher");expect(row).not.toContain("data-sidebar-top-spacer");expect(classesOf(row, "data-sidebar-top-row")).toEqual(["flex", "items-center", "flex-col", "gap-1", "px-2", "pt-3.5", "pb-1"]);- expect(classesOf(row, "data-traffic-light-space")).toEqual(["h-5", "w-full"]);+ expect(row).not.toContain("data-traffic-light-space");expect(classesOf(row, "data-sidebar-top-buttons")).toEqual(["relative", "flex", "shrink-0", "items-center", "flex-col", "gap-1"]);expect(html.match(/Switch server:/g)).toHaveLength(1);});@@ -257,15 +254,27 @@ describe("the button that hides and shows the window's rail of places", () => {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", () => {+ it("moves to the window frame's top bar on macOS and Windows: no row of the sidebar holds it", () => {+ for (const windowChrome of ["mac-inset", "win-caption"] as const) {+ fixture.windowChrome = windowChrome;+ for (const [advanced, density] of [[true, "comfortable"], [false, "comfortable"], [true, "icons"], [false, "icons"]] as const) {+ fixture.advanced = advanced;+ fixture.density = density;+ expect(render(), `${windowChrome}, ${advanced ? "Advanced" : "Simple"}, ${density}`).not.toContain("data-rail-toggle");+ }+ }+ });++ it("leads the row on Linux, round like the row's other buttons, its words saying what a click does", () => {+ fixture.windowChrome = "native";+ fixture.hostLabel = "Linux";const advanced = row();- expect(advanced.indexOf("data-traffic-light-space")).toBeLessThan(advanced.indexOf("data-rail-toggle"));+ expect(advanced.indexOf("data-rail-toggle")).toBeGreaterThan(-1);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(toggle(advanced)).toMatch(/aria-label="Hide your computers" title="Hide your computers" aria-expanded="true" 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-");@@ -273,30 +282,17 @@ describe("the button that hides and shows the window's rail of places", () => {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", () => {+ it("tops the column of buttons on Linux when the sidebar shows only avatars", () => {+ fixture.windowChrome = "native";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")).toBeGreaterThan(-1);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", () => {diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex a48c82bd8a..709bc6a37c 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -25,7 +25,7 @@ import { BulkSelectFilters, ThreadListFooter, deleteThreadsInBulk, useBulkSelectimport { StackedMauses } from "./StackedMauses";import { LocalComputerAutoWarning } from "./LocalComputerAutoWarning";import { nextRename } from "@/lib/rename";-import { useDesktopCapabilities } from "./DesktopCapabilities";+import { useDesktopCapabilities, windowFramed } from "./DesktopCapabilities";import { MIN_QUERY, SearchResults } from "./SearchResults";import { TeamLibraryPanel } from "./TeamLibraryPanel";import { SidebarNewChatPanel } from "./SidebarNewChatPanel";@@ -70,7 +70,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 { usePlaces } from "@/lib/places"; import { PlaceTint } from "./PlaceTint"; import { ChromeRailToggle } from "./ChromeRailToggle";+import { DesktopWorkspaceSwitcher, endCloudHowTo } from "./DesktopWorkspaceSwitcher"; 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";@@ -80,7 +80,7 @@ import { ELEVATED_CONTROL } from "./elevated";import { departmentOwner, useTeamPeople } from "@/state/team-people";export { TeamMenuItems };import { SidebarResizeHandle, useSidebarWidth } from "./SidebarResizeHandle";-import { PHONE_TOP_BUTTON, SIMPLE_ROW_FOCUS, SIMPLE_TOP_BUTTON, SidebarEdgeToggle, SidebarSearchPill, SidebarSearchToggle } from "./SidebarSimpleTop";+import { PHONE_TOP_BUTTON, SIMPLE_CORNER_BUTTON, SIMPLE_ROW_FOCUS, SIMPLE_TOP_BUTTON, SidebarEdgeToggle, SidebarSearchPill, SidebarSearchToggle } from "./SidebarSimpleTop";import { isSidebarToggle } from "@/lib/keyboard-shortcuts";import { SidebarRailSeparator, SimpleRailFooter } from "./SidebarSimpleRail";import { useShowThreads } from "@/lib/thread-preferences";@@ -110,9 +110,6 @@ export { PinnedBotCircle, PinnedCircleThreadPanel, PinnedCircleThreadSection } fexport { ArchivedBotRow, ArchivedBotsPanel, archivedDeleteAllCopy, botConfirmCopy, type BotConfirmKind } from "./ArchivedBotsPanel";import { roomDeleteCopy } from "./room-delete-copy"; export { roomDeleteCopy };-/** Coupled to electron/window-chrome.mjs: trafficLightPosition.y = 16 and 14px-tall buttons. */-export const MAC_TRAFFIC_LIGHT_CENTER_Y = 23;-const SECTION_LABEL_KEYS: Record<string, LocaleKey> = {[PINNED_SECTION_ID]: "sidebar.section.pinned",[CHANNELS_SECTION_ID]: "sidebar.section.channels",@@ -1095,8 +1092,10 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {}};- const macInset = capabilities.windowChrome === "mac-inset", pageRail = usePlaces().places.length > 0;- const draggableChrome = macInset || capabilities.windowChrome === "win-caption";+ // A framed window (WindowFrameBar) holds the traffic lights and the rail's button in its top bar, so the top row keeps+ // no room for them; in Simple it is only the corner holding Search and New, with the bot tiles beside it.+ const framed = windowFramed(capabilities.windowChrome), corner = framed && simpleDesk;+ const draggableChrome = framed;// SAFETY: Electron's -webkit-app-region is not in React's CSSProperties type; the renderer accepts it as an inline// style.const windowDragStyle = draggableChrome@@ -1177,13 +1176,13 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {ref={importReturnRef}onClick={() => setPlusOpen((o) => !o)}aria-label={remoteClient ? t("sidebar.new") : t("sidebar.newOrShare")}- className={phone ? PHONE_TOP_BUTTON : rail || simple ? SIMPLE_TOP_BUTTON : cn(+ className={phone ? PHONE_TOP_BUTTON : corner ? SIMPLE_CORNER_BUTTON : rail || simple ? SIMPLE_TOP_BUTTON : cn("flex 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",density === "icons" ? "size-[46px] shrink-0 rounded-xl" : "size-8 rounded-full",)}title={remoteClient ? t("sidebar.new") : t("sidebar.newOrShare")}>- <Plus size={phone || simple || density === "icons" ? 20 : 18} strokeWidth={phone ? 2 : 1.5} />+ <Plus size={corner ? 18 : phone || simple || density === "icons" ? 20 : 18} strokeWidth={phone ? 2 : 1.5} /></button>{plusMotion.shown && (<>@@ -1289,20 +1288,18 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {<GlassScrollFrame className="flex-1" fade><PlaceTint /><GlassBar edge="top"><div- data-sidebar-top-row+ data-sidebar-top-row={corner ? "corner" : true}className={cn("flex items-center",- density === "icons" ? "flex-col gap-1 px-2 pt-3.5 pb-1" : simpleDesk ? "relative h-[60px] items-start pl-4 pr-4 pt-3" : "relative pl-4 pr-2",- density !== "icons" && !macInset && !simpleDesk && "h-12 max-md:h-16",+ // The corner is no drag region and takes no clicks but its buttons': the tiles rise into the rest of it.+ density === "icons" ? "flex-col gap-1 px-2 pt-3.5 pb-1" : corner ? "pointer-events-none relative h-[34px] items-start justify-end px-1.5 pt-1.5" : simpleDesk ? "relative h-[60px] items-start pl-4 pr-4 pt-3" : "relative pl-4 pr-2",+ density !== "icons" && !simpleDesk && "h-12 max-md:h-16",)}- style={density !== "icons" && macInset && !simpleDesk ? { ...windowDragStyle, height: MAC_TRAFFIC_LIGHT_CENTER_Y * 2 } : windowDragStyle}+ style={corner ? undefined : windowDragStyle}>{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, 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))]"} />- ) : null}{!phone && <ChromeRailToggle advanced={advanced} icons={density === "icons"} style={windowNoDragStyle} />}+ ) : null}{!phone && !framed && <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" />@@ -1319,10 +1316,10 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {))}{!rail && <divdata-sidebar-top-buttons- className={cn("relative flex shrink-0 items-center", density === "icons" ? "flex-col gap-1" : simpleDesk ? "gap-2" : simple ? "gap-1 pl-0.5" : "ml-0.5 gap-0.5")}+ className={cn("relative flex shrink-0 items-center", density === "icons" ? "flex-col gap-1" : corner ? "pointer-events-auto" : simpleDesk ? "gap-2" : simple ? "gap-1 pl-0.5" : "ml-0.5 gap-0.5")}style={windowNoDragStyle}>- {simpleDesk && <SidebarSearchToggle ref={searchToggleRef} open={searchShown} onToggle={() => (searchShown ? closeSearch() : setSearchOpen(true))} />}+ {simpleDesk && <SidebarSearchToggle ref={searchToggleRef} corner={corner} open={searchShown} onToggle={() => (searchShown ? closeSearch() : setSearchOpen(true))} />}{!collapseToIcons && !phone && (advanced || density === "icons") && <buttontype="button"onClick={toggleCollapsed}@@ -1454,7 +1451,7 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {onToggle={layoutInteractive ? () => toggleSection(PINNED_THREADS_SECTION_ID) : undefined}/>)}- {tiles && <SidebarTileGrid primary={primary} pinned={pinnedBots} row={botRow} />}+ {tiles && <SidebarTileGrid primary={primary} pinned={pinnedBots} row={botRow} corner={corner} />}{simpleDesk && !tiles && <SidebarNoBots />}</GlassBar>diff --git a/src/components/SidebarSimpleTop.tsx b/src/components/SidebarSimpleTop.tsxindex 0212c233d1..fafa52d84e 100644--- a/src/components/SidebarSimpleTop.tsx+++ b/src/components/SidebarSimpleTop.tsx@@ -16,6 +16,9 @@ export const SIMPLE_TOP_BUTTON = `${SIMPLE_TOP} ${ELEVATED_CONTROL} ${ELEVATED_H* wears the tint of an open menu. */export const SIMPLE_TOP_TOGGLE = `${SIMPLE_TOP} ${ELEVATED_CONTROL} ${ELEVATED_TINT} ${SIMPLE_TOP_FOCUS}`;+/** Search and New in the top corner of Simple's sidebar in a framed window: plain icons, each its own button. */+export const SIMPLE_CORNER_BUTTON = `flex size-[26px] shrink-0 items-center justify-center rounded-lg text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06] aria-expanded:text-ink ${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";@@ -77,7 +80,7 @@ export function SidebarEdgeToggle({ collapsed, onToggle, style, anchorRef, shownreturn pinned ? createPortal(button, document.body) : button;}-export function SidebarSearchToggle({ open, onToggle, ref }: { open: boolean; onToggle: () => void; ref?: Ref<HTMLButtonElement> }) {+export function SidebarSearchToggle({ open, onToggle, corner = false, ref }: { open: boolean; onToggle: () => void; corner?: boolean; ref?: Ref<HTMLButtonElement> }) {return (<buttonref={ref}@@ -87,9 +90,9 @@ export function SidebarSearchToggle({ open, onToggle, ref }: { open: boolean; onaria-label={t("sidebar.searchAria")}aria-expanded={open}title={t("sidebar.searchAria")}- className={SIMPLE_TOP_BUTTON}+ className={corner ? SIMPLE_CORNER_BUTTON : SIMPLE_TOP_BUTTON}>- <Search size={18} strokeWidth={1.5} aria-hidden="true" />+ <Search size={corner ? 17 : 18} strokeWidth={1.5} aria-hidden="true" /></button>);}diff --git a/src/components/SidebarTiles.tsx b/src/components/SidebarTiles.tsxindex ab28e2aa4b..b24a369acc 100644--- a/src/components/SidebarTiles.tsx+++ b/src/components/SidebarTiles.tsx@@ -1,5 +1,5 @@import { Crown, Loader2, Phone } from "lucide-react";-import { memo, useState, type KeyboardEvent, type MouseEvent } from "react";+import { memo, useLayoutEffect, useRef, useState, type KeyboardEvent, type MouseEvent } from "react";import { botShowsUnread } from "@/lib/bot-unread";import { cn } from "@/lib/cn";@@ -134,11 +134,44 @@ export function SidebarNoBots() {return <p data-sidebar-empty="" className="px-5 pt-4 text-[13px] leading-[18px] text-ink-tertiary">{t("onboarding.shell.noBots")}</p>;}-export function SidebarTileGrid({ primary, pinned, row }: { primary: Bot | null; pinned: Bot[]; row: (bot: Bot) => BotRowProps }) {+/** How much of the grid's right end Search and New take in a framed window's corner (Sidebar's corner row). */+const CORNER_CLEAR = 60;++/** Whether the tiles' first row, as laid out, ends before the corner's buttons: the sidebar's width and the number of+ * tiles decide it. */+export function tilesClearCorner(tiles: { top: number; right: number }[], gridRight: number): boolean {+ if (!tiles.length) return false;+ const top = tiles[0]!.top;+ return Math.max(...tiles.filter((tile) => Math.abs(tile.top - top) < 1).map((tile) => tile.right)) <= gridRight - CORNER_CLEAR;+}++/** While the tiles clear the corner they rise beside its buttons (styles.css); else they start under them. */+function useBesideCorner(corner: boolean, count: number) {+ const ref = useRef<HTMLDivElement>(null);+ const [beside, setBeside] = useState(false);+ useLayoutEffect(() => {+ const grid = ref.current;+ if (!corner || !grid) { setBeside(false); return; }+ const measure = () => {+ const tiles = [...grid.querySelectorAll<HTMLElement>("[data-sidebar-tile]")].map((tile) => tile.getBoundingClientRect());+ setBeside(tilesClearCorner(tiles, grid.getBoundingClientRect().right));+ };+ measure();+ if (typeof ResizeObserver === "undefined") return;+ const observer = new ResizeObserver(measure);+ observer.observe(grid);+ return () => observer.disconnect();+ }, [corner, count]);+ return { ref, beside };+}++export function SidebarTileGrid({ primary, pinned, row, corner = false }: { primary: Bot | null; pinned: Bot[]; row: (bot: Bot) => BotRowProps; corner?: boolean }) {const order = usePinnedCircleDrag(pinned);+ const besideCorner = useBesideCorner(corner, (primary ? 1 : 0) + order.ranked.length);if (!primary && order.ranked.length === 0) return null;return (- <div data-sidebar-tiles="" className="flex max-h-[40vh] flex-wrap justify-center gap-1 overflow-y-auto px-3 pb-4 pt-2.5" {...order.frameProps}>+ <div ref={besideCorner.ref} data-sidebar-tiles="" data-beside-corner={besideCorner.beside ? "" : undefined}+ className="flex max-h-[40vh] flex-wrap justify-center gap-1 overflow-y-auto px-3 pb-4 pt-2.5" {...order.frameProps}>{primary && <SidebarBotTile {...row(primary)} primary />}{order.ranked.map((bot) => <SidebarBotTile key={bot.id} {...row(bot)} {...order.dragProps(bot)} />)}<span role="status" className="sr-only">{order.moved}</span>diff --git a/src/components/TriggersPage.tsx b/src/components/TriggersPage.tsxindex 7579cc738d..69f4df59e1 100644--- a/src/components/TriggersPage.tsx+++ b/src/components/TriggersPage.tsx@@ -69,7 +69,7 @@ export function TriggersPage({ onBack, onOpenRoom }: { onBack: () => void; onOpereturn (<main className="flex h-full min-w-0 flex-1 flex-col bg-app animate-workspace-in">- <header className={cn("shrink-0 border-b border-hairline/35 bg-app py-3 pr-4", macInset && view === "calendar" ? "pl-[86px]" : view === "list" ? "pl-12 md:pl-4" : "pl-4")} style={windowDragStyle}>+ <header className={cn("shrink-0 border-b border-hairline/35 bg-app py-3 pr-4", view === "list" ? "pl-12 md:pl-4" : "pl-4")} style={windowDragStyle}><div className="flex flex-wrap items-center gap-2"><button type="button" ref={backButtonRef} onClick={onBack} aria-label="Back" title="Back" className="flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink" style={windowNoDragStyle}><ArrowLeft size={18} /></button><h1 data-tour="automations-page" className="mr-1 text-[18px] font-semibold tracking-tight text-ink">{t("automations.title")}</h1>diff --git a/src/components/UpdateIndicator.tsx b/src/components/UpdateIndicator.tsxindex 5566900d73..be66acca37 100644--- a/src/components/UpdateIndicator.tsx+++ b/src/components/UpdateIndicator.tsx@@ -8,6 +8,7 @@ import { RELEASES_URL, appVersion, openExternalLink } from "@/lib/app-links";import { productName } from "../lib/brand";import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";+import { useDesktopCapabilities, windowFramed } from "./DesktopCapabilities";export function updateIndicatorShown(state: UpdaterState | null): boolean {return Boolean(state && ["downloading", "preparing", "downloaded", "installing"].includes(state.status));@@ -25,19 +26,54 @@ export function updateIndicatorLabel(state: UpdaterState): string {: t("update.button.downloading", { percent: Math.round(state.percent) });}-export function UpdateIndicator({ className }: { className?: string }) {+/** The pill's own words, short enough for the window frame's top bar; its title keeps the long ones. */+export function updatePillText(state: UpdaterState): string {+ if (state.status === "downloaded" || state.status === "installing") return t("update.card.restart");+ if (state.status === "preparing") return t("update.button.preparing");+ return state.percent == null ? t("update.card.downloadingStart") : t("update.card.downloading", { percent: Math.round(state.percent) });+}++/** `bar`: the pill in the window frame's top bar. In a framed window that pill is the only one, so the sidebar's+ * round buttons draw nothing. */+export function UpdateIndicator({ className, bar = false }: { className?: string; bar?: boolean }) {const state = useUpdaterState();+ const framed = windowFramed(useDesktopCapabilities().capabilities.windowChrome);const [open, setOpen] = useState(false);const buttonRef = useRef<HTMLButtonElement>(null);const settled = !state || state.status === "idle" || state.status === "checking" || state.status === "handed-off";useEffect(() => {if (settled) setOpen(false);}, [settled]);+ if (framed && !bar) return null;if (!state || !updateIndicatorShown(state)) {return open && !settled ? <UpdateCard state={state} onClose={() => setOpen(false)} returnFocusRef={buttonRef} /> : null;}const label = updateIndicatorLabel(state);const ready = state.status === "downloaded";+ if (bar) return (+ <>+ <button+ ref={buttonRef}+ type="button"+ data-update-indicator={state.status}+ aria-label={label}+ aria-haspopup="dialog"+ title={label}+ onClick={() => setOpen(true)}+ className={cn(+ "me-1 flex h-5 shrink-0 items-center gap-1.5 rounded-full bg-menu ps-0.5 pe-2.5 text-[12px] font-medium leading-none text-ink shadow-sm ring-1 ring-ink/10 transition-shadow hover:ring-ink/25",+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",+ className,+ )}+ >+ <span aria-hidden className="flex size-4 items-center justify-center rounded-full bg-accent text-accent-ink">+ <ArrowDown size={11} strokeWidth={2.5} className={cn(!ready && "animate-pulse")} />+ </span>+ {updatePillText(state)}+ </button>+ {open && <UpdateCard state={state} onClose={() => setOpen(false)} returnFocusRef={buttonRef} />}+ </>+ );return (<divclassName={cn("flex size-[46px] shrink-0 items-center justify-center", className)}diff --git a/src/components/WindowCaptionButtons.tsx b/src/components/WindowCaptionButtons.tsxindex 769f0b5c2c..33931848f3 100644--- a/src/components/WindowCaptionButtons.tsx+++ b/src/components/WindowCaptionButtons.tsx@@ -3,7 +3,8 @@ import { Minus, Square, Copy, X } from "lucide-react";import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";-/** Drawn by the renderer because the WCO overlay API cannot style hover. */+/** Drawn by the renderer because the WCO overlay API cannot style hover. They fill the right end of the window frame's+ * top bar (WindowFrameBar), which keeps their width clear. */export function WindowCaptionButtons({ visible }: { visible: boolean }) {const [maximized, setMaximized] = useState(false);@@ -28,7 +29,7 @@ export function WindowCaptionButtons({ visible }: { visible: boolean }) {// style.const noDrag = { WebkitAppRegion: "no-drag" } as CSSProperties;const captionButton = cn(- "flex h-[26px] w-11 items-center justify-center text-ink-secondary",+ "flex h-7 w-11 items-center justify-center text-ink-secondary","hover:bg-raised hover:text-ink active:bg-raised/60",);diff --git a/src/components/WindowFrameBar.test.ts b/src/components/WindowFrameBar.test.tsnew file mode 100644index 0000000000..8a50f727a3--- /dev/null+++ b/src/components/WindowFrameBar.test.ts@@ -0,0 +1,104 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import type { UpdaterState } from "@/types/ogb";++const fixture = vi.hoisted(() => ({+ windowChrome: "mac-inset" as "mac-inset" | "win-caption" | "native",+ rail: { available: true, hidden: false } as { available: boolean; hidden: boolean } | null,+ update: null as UpdaterState | null,+ dispatch: vi.fn(),+}));+vi.mock("@/lib/chrome-rail", () => ({ useChromeRail: () => fixture.rail, setChromeRailHidden: () => {} }));+vi.mock("@/lib/updater", () => ({ useUpdaterState: () => fixture.update }));+vi.mock("@/state/store", () => ({ useStore: () => ({ state: {}, dispatch: fixture.dispatch }) }));+vi.mock("./DesktopCapabilities", async (importOriginal) => ({+ ...await importOriginal<typeof import("./DesktopCapabilities")>(),+ useDesktopCapabilities: () => ({ capabilities: { windowChrome: fixture.windowChrome }, ready: true }),+}));++import { setLocale } from "@/lib/i18n";+import { tilesClearCorner } from "./SidebarTiles";+import { UpdateIndicator } from "./UpdateIndicator";+import { WindowFrameBar } from "./WindowFrameBar";++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+let host: HTMLDivElement, root: Root | null = null;+beforeEach(() => {+ setLocale("en");+ host = document.createElement("div");+ document.body.append(host);+ fixture.windowChrome = "mac-inset";+ fixture.rail = { available: true, hidden: false };+ fixture.update = null;+ fixture.dispatch.mockClear();+});+afterEach(async () => { await act(async () => root?.unmount()); root = null; host.remove(); });++async function mount(element: ReturnType<typeof createElement>) {+ root = createRoot(host);+ await act(async () => root!.render(element));+}+const bar = () => host.querySelector<HTMLElement>("[data-window-frame-bar]");++describe("the window frame's top bar", () => {+ it("is drawn on macOS, as thin as the traffic lights allow, and drags the window; its first button starts after the lights", async () => {+ await mount(createElement(WindowFrameBar));+ const classes = bar()!.className.split(" ");+ expect(classes).toEqual(expect.arrayContaining(["h-7", "bg-frame", "pl-[calc(80px_-_var(--rail-beside,0px))]"]));+ expect(bar()!.hasAttribute("data-window-drag"), "the drag region every header marks (window-drag-regions.test.ts)").toBe(true);+ const buttons = [...bar()!.querySelectorAll("button")].map((button) => button.getAttribute("aria-label"));+ expect(buttons, "the rail's button, then the app's settings; no update while there is none").toEqual(["Hide your computers", "App settings"]);+ expect(bar()!.querySelector("[data-rail-toggle]")!.className).toContain("size-[22px]");+ });++ it("leaves the caption buttons the right end on Windows, and draws nothing where the window has its own title bar", async () => {+ fixture.windowChrome = "win-caption";+ await mount(createElement(WindowFrameBar));+ expect(bar()!.className.split(" ")).toEqual(expect.arrayContaining(["pl-2", "pr-[140px]"]));+ await act(async () => root!.unmount());+ fixture.windowChrome = "native";+ await mount(createElement(WindowFrameBar));+ expect(bar()).toBeNull();+ });++ it("opens the app's settings", async () => {+ await mount(createElement(WindowFrameBar));+ await act(async () => bar()!.querySelector<HTMLButtonElement>("[data-frame-settings]")!.click());+ expect(fixture.dispatch).toHaveBeenCalledWith({ type: "toggleAppSettings", open: true });+ });++ it("holds the update in short words while there is one, and the sidebar's round buttons step aside for it", async () => {+ fixture.update = { status: "downloading", percent: 45.4 };+ await mount(createElement("div", null, createElement(WindowFrameBar), createElement("aside", null, createElement(UpdateIndicator))));+ expect(bar()!.querySelector("[data-update-indicator]")!.textContent).toBe("Downloading 45%");+ expect(host.querySelector("aside")!.innerHTML, "one update button in a framed window").toBe("");+ fixture.update = { status: "downloaded", version: "0.1.134" };+ await act(async () => root!.render(createElement(WindowFrameBar)));+ const pill = bar()!.querySelector("[data-update-indicator='downloaded']")!;+ expect(pill.textContent).toBe("Restart to update");+ expect(pill.getAttribute("title"), "its title keeps the long words").toContain("0.1.134");+ fixture.windowChrome = "native";+ await act(async () => root!.render(createElement(UpdateIndicator)));+ expect(host.querySelector("[data-update-indicator='downloaded']"), "unframed, the sidebar keeps its own").not.toBeNull();+ });+});++describe("Simple's sidebar corner", () => {+ // A 280px sidebar: 78px tiles 4px apart, centred, the grid's right edge at 280.+ const row = (count: number, top = 10) => {+ const width = count * 82 - 4, left = (280 - width) / 2;+ return Array.from({ length: count }, (_, index) => ({ top, right: left + index * 82 + 78 }));+ };++ it("lets the tiles rise beside Search and New only while their first row ends before them", () => {+ expect(tilesClearCorner(row(1), 280)).toBe(true);+ expect(tilesClearCorner(row(2), 280)).toBe(true);+ expect(tilesClearCorner(row(3), 280)).toBe(false);+ expect(tilesClearCorner([...row(2), ...row(1, 106)], 280), "a second row under it changes nothing").toBe(true);+ expect(tilesClearCorner(row(2), 240), "a narrower sidebar").toBe(false);+ expect(tilesClearCorner([], 280)).toBe(false);+ });+});diff --git a/src/components/WindowFrameBar.tsx b/src/components/WindowFrameBar.tsxnew file mode 100644index 0000000000..803d513f52--- /dev/null+++ b/src/components/WindowFrameBar.tsx@@ -0,0 +1,46 @@+import { Settings } from "lucide-react";++import { cn } from "@/lib/cn";+import { t } from "@/lib/i18n";+import { useStore } from "@/state/store";+import { ChromeRailToggle } from "./ChromeRailToggle";+import { captionChrome, useDesktopCapabilities, windowFramed } from "./DesktopCapabilities";+import { UpdateIndicator } from "./UpdateIndicator";++/** A button in the frame's top bar: small, quiet, the bar's height and no more. */+export const FRAME_BAR_BUTTON = "flex size-[22px] shrink-0 items-center justify-center rounded-md text-ink-secondary transition-colors hover:bg-ink/[0.07] hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus";++/** The window frame's top bar (windowFramed), as thin as the traffic lights allow: they sit in it on macOS (main puts+ * them there: electron/window-chrome.mjs), the caption buttons on Windows (WindowCaptionButtons, drawn over its right+ * end). The rail's button follows the traffic lights; an update while there is one, and the app's settings, close the+ * right end. The whole bar drags the window. It starts at the page's left edge, beside the window's rail when that+ * shows, whose own page paints the bar's colour above its places. */+export function WindowFrameBar() {+ const { capabilities } = useDesktopCapabilities();+ const { dispatch } = useStore();+ const chrome = capabilities.windowChrome;+ if (!windowFramed(chrome)) return null;+ const { dragProps } = captionChrome(chrome);+ return (+ <div+ data-window-frame-bar+ {...dragProps}+ // macOS: the traffic lights span 12-72px of the window, so the first button starts at 80px, wherever the page does.+ className={cn("flex h-7 shrink-0 items-center gap-0.5 bg-frame", chrome === "mac-inset" ? "pl-[calc(80px_-_var(--rail-beside,0px))] pr-2" : "pl-2 pr-[140px]")}+ >+ <ChromeRailToggle bar={FRAME_BAR_BUTTON} />+ <div className="min-w-0 flex-1" />+ <UpdateIndicator bar />+ <button+ type="button"+ data-frame-settings+ aria-label={t("sidebar.appSettings")}+ title={t("sidebar.appSettings")}+ onClick={() => dispatch({ type: "toggleAppSettings", open: true })}+ className={FRAME_BAR_BUTTON}+ >+ <Settings size={15} strokeWidth={1.75} aria-hidden="true" />+ </button>+ </div>+ );+}diff --git a/src/components/bot-panel/PanelShell.tsx b/src/components/bot-panel/PanelShell.tsxindex e0d9bd5895..636700ab90 100644--- a/src/components/bot-panel/PanelShell.tsx+++ b/src/components/bot-panel/PanelShell.tsx@@ -21,10 +21,9 @@ function initialTarget(section: BotSettingsSection | null, link: PanelLink | nulreturn section ? linkTarget(section, link) : { tab: "details" };}-export function BotPanel({ bot, derived, headerClassName, linkedSection, onClose }: {+export function BotPanel({ bot, derived, linkedSection, onClose }: {bot: Bot;derived: ReturnType<typeof useBotSettingsDerived>;- headerClassName?: string;linkedSection: BotSettingsSection | null;onClose: () => void;}) {@@ -97,7 +96,7 @@ export function BotPanel({ bot, derived, headerClassName, linkedSection, onClosereturn (<div className="flex min-h-0 flex-1 flex-col" onKeyDown={onKeyDown}>- <div {...dragProps} className={cn("flex h-[50px] shrink-0 items-start justify-end gap-2.5 px-[13px] pt-[13px]", headerClassName)}>+ <div {...dragProps} className="flex h-[50px] shrink-0 items-start justify-end gap-2.5 px-[13px] pt-[13px]"><ChatShareMenu bot={bot} className={roundButtonCls} /><buttontype="button"diff --git a/src/components/remote-desktop-panel.tsx b/src/components/remote-desktop-panel.tsxindex 7bc28dcfaa..60a4358ce6 100644--- a/src/components/remote-desktop-panel.tsx+++ b/src/components/remote-desktop-panel.tsx@@ -63,7 +63,7 @@ function nextRunLabel(at: number | null) {export function RemoteDesktopPanel({ bot }: { bot: Bot }) {const { state, dispatch } = useStore();- const { padClass, dragProps } = useCaptionChrome();+ const { dragProps } = useCaptionChrome();const panelRef = useComputerPanelEntry(bot.id);const [pending, setPending] = useState(false);const [error, setError] = useState<string | null>(null);@@ -211,7 +211,7 @@ export function RemoteDesktopPanel({ bot }: { bot: Bot }) {return (<aside className="relative z-20 flex h-full w-[400px] shrink-0 flex-col border-l border-hairline bg-panel" ref={panelRef} data-computer-panel>- <div {...dragProps} className={cn("flex items-center justify-between border-b border-hairline px-5 py-4", padClass)}>+ <div {...dragProps} className="flex items-center justify-between border-b border-hairline px-5 py-4"><div><div className="text-[14px] font-medium text-ink">{bot.name}'s computer</div><div className="mt-0.5 text-[11px] text-ink-secondary">diff --git a/src/components/room-panel/RoomPanel.tsx b/src/components/room-panel/RoomPanel.tsxindex 027e6dfeee..926e01113d 100644--- a/src/components/room-panel/RoomPanel.tsx+++ b/src/components/room-panel/RoomPanel.tsx@@ -115,7 +115,7 @@ function InstructionsRow({ group }: { group: Group }) {export function RoomPanel({ group, overlay = false }: { group: Group; overlay?: boolean }) {const { state } = useStore();- const { padClass, dragProps } = useCaptionChrome();+ const { dragProps } = useCaptionChrome();const [page, setPage] = useState<RoomPage | null>(null);const [membersOpen, setMembersOpen] = useState(false);const dialogRef = useRef<HTMLElement>(null);@@ -180,7 +180,7 @@ export function RoomPanel({ group, overlay = false }: { group: Group; overlay?:onKeyDown={onKeyDown}className={sidePanelCls(overlay, true)}>- <div {...dragProps} className={cn("flex h-[52px] shrink-0 items-center justify-end gap-2 px-3.5", padClass)}>+ <div {...dragProps} className="flex h-[52px] shrink-0 items-center justify-end gap-2 px-3.5"><RoomMoreMenu group={group} /><button type="button" onClick={() => closeRoomPanel({ refocus: true })} aria-label={t("botSettings.simple.close")} className={roundButtonCls}><X size={16} className="pointer-events-none" />diff --git a/src/components/window-drag-regions.test.ts b/src/components/window-drag-regions.test.tsindex c0e151610d..5870dd4913 100644--- a/src/components/window-drag-regions.test.ts+++ b/src/components/window-drag-regions.test.ts@@ -14,7 +14,7 @@ vi.mock("@/lib/interface-mode", () => ({ useAdvancedMode: () => true, setAdvanceconst { ChatView } = await import("./ChatView");const { GroupView } = await import("./GroupView");-const { DesktopCapabilitiesProvider, WindowDragStrip, captionChrome } = await import("./DesktopCapabilities");+const { DesktopCapabilitiesProvider, WindowDragStrip, captionChrome, windowFramed } = await import("./DesktopCapabilities");const css = readFileSync(new URL("../styles.css", import.meta.url), "utf8");const noDragRule = /\/\* Window drag regions\.[\s\S]*?\*\/\s*([^{]+)\{\s*-webkit-app-region: no-drag;/.exec(css);@@ -71,11 +71,12 @@ describe("caption chrome", () => {},);- it("keeps the caption corner offsets on Windows only", () => {- expect(captionChrome("win-caption").controlsShiftStyle).toMatchObject({ marginTop: "16px" });- expect(captionChrome("win-caption").padClass).toBe("pt-[28px]");- expect(captionChrome("mac-inset").controlsShiftStyle).toBeUndefined();- expect(captionChrome("mac-inset").padClass).toBeUndefined();+ it("frames the window on macOS and Windows: nothing under the frame's top bar moves out of the window's buttons", () => {+ expect([windowFramed("mac-inset"), windowFramed("win-caption"), windowFramed("native"), windowFramed(undefined)]).toEqual([true, true, false, false]);+ for (const chrome of ["mac-inset", "win-caption", "native"] as const) {+ expect(Object.keys(captionChrome(chrome))).not.toContain("padClass");+ expect(Object.keys(captionChrome(chrome))).not.toContain("controlsShiftStyle");+ }});it("opts controls, menus and dialogs out of a drag region in styles.css", () => {@@ -102,12 +103,12 @@ describe.each([expect(region(header.querySelector("[data-chathead-identity], [data-roomhead-identity]"))).toBe("no-drag");});- it("drops the right-hand controls below the caption buttons on Windows only", () => {+ it("keeps the right-hand controls level on Windows too: the caption buttons sit in the frame's top bar above it", () => {const controls = (chrome: Chrome) => {fixture.chrome = chrome;return dom(view()).querySelector("[data-chathead-controls], [data-roomhead-controls]");};- expect(styleValue(controls("win-caption"), "margin-top")).toBe("16px");+ expect(styleValue(controls("win-caption"), "margin-top")).toBe("");expect(styleValue(controls("mac-inset"), "margin-top")).toBe("");});diff --git a/src/styles.css b/src/styles.cssindex a576d2a7eb..d973d3c1d4 100644--- a/src/styles.css+++ b/src/styles.css@@ -162,6 +162,11 @@there `raised` is pure white and a card is too. */--color-control: #282828;--color-hairline: #383838;+ /* the window's frame: its top bar and the rail of places, around the app's+ rounded card. A step from the sidebar toward the ink, so every skin gets+ one without naming it: a shade darker on the light skins, lighter on the+ dark ones. */+ --color-frame: color-mix(in oklab, var(--color-panel) 93%, var(--color-ink));--color-ink: #f5f5f5;--color-ink-secondary: #f5f5f5a8;/* quiet text: timestamps, hints, placeholders, calendar hours. It used to@@ -2944,6 +2949,13 @@ button:disabled.bg-danger {-webkit-app-region: no-drag;}+/* Simple's sidebar in the window frame: Search and New sit in its top corner+ (Sidebar's corner row), and the bot tiles rise beside them while their first+ row leaves the corner free (SidebarTileGrid measures it). */+[data-sidebar-top-row="corner"] + [data-sidebar-tiles][data-beside-corner] {+ margin-top: -34px;+}+/* Room speaker names. Each skin sets a tone of the bot's palette that clears4.5:1 on the thread (--color-app). The class below only picks the token. */.bot-identity[data-bot-color="green"] { color: var(--identity-green); }