Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(desktop): one geometry for every chrome icon control
ZeroYa295a124bac6
diff --git a/apps/desktop/src/features/app/AppShell.tsx b/apps/desktop/src/features/app/AppShell.tsxindex 933e48def..90abef703 100644--- a/apps/desktop/src/features/app/AppShell.tsx+++ b/apps/desktop/src/features/app/AppShell.tsx@@ -136,7 +136,7 @@ export function AppShell() {data-nav="new-task"onClick={() => void runMenuCommand("newTask")}>- <IconNewSession size={13} />+ <IconNewSession size={15} /></TooltipButton>)}<div className="window-chrome-drag" aria-hidden />diff --git a/apps/desktop/src/features/app/chrome.tsx b/apps/desktop/src/features/app/chrome.tsxindex 5c1a4e22f..973250f80 100644--- a/apps/desktop/src/features/app/chrome.tsx+++ b/apps/desktop/src/features/app/chrome.tsx@@ -57,7 +57,7 @@ export function CollapsedTitlebarActions({data-nav="toggle-sidebar"onClick={onToggleSidebar}>- <IconSidebar size={13} />+ <IconSidebar size={15} /></TooltipButton><TooltipButtonclassName="title-nav-btn"@@ -66,7 +66,7 @@ export function CollapsedTitlebarActions({data-nav="new-task"onClick={onNewTask}>- <IconNewSession size={13} />+ <IconNewSession size={15} /></TooltipButton></div>);diff --git a/apps/desktop/src/styles/chrome.css b/apps/desktop/src/styles/chrome.cssindex e1707c1db..526ddd8ff 100644--- a/apps/desktop/src/styles/chrome.css+++ b/apps/desktop/src/styles/chrome.css@@ -389,30 +389,16 @@padding-left: max(0px, calc(var(--ds-window-lead-inset) - 12px));}+/* Preview- and route-band actions take the shared chrome-control geometry from+ the `.ct-icon-btn` group below (28px square, `--radius-md`, transparent seat,+ hover wash). Only the press feedback belongs to the lane itself. */.title-nav-btn {- display: inline-flex;- height: 22px;- width: 22px;- align-items: center;- justify-content: center;- border-radius: var(--radius-2xs);- color: color-mix(in oklab, var(--ds-text-primary) 55%, transparent);- background: var(--ds-tile);transition:background var(--motion-duration-fast) var(--motion-ease-out),color var(--motion-duration-fast) var(--motion-ease-out),transform var(--motion-duration-fast) var(--motion-ease-out);}-.title-nav-btn:hover:not(:disabled) {- color: var(--ds-text-primary);- background: var(--ds-bg-hover);-}--.title-nav-btn:disabled {- opacity: 0.28;-}-.title-nav-btn.active {color: var(--ds-text-primary);background: var(--ds-bg-active);@@ -529,11 +515,17 @@line-height: var(--leading-compact);}+/* One geometry for every chrome icon control: the topbar's dock toggle, the+ viewport-fixed work-panel toggle, and the preview/route-band lane actions.+ `flex: 0 0` keeps them square when a crowded band would otherwise squeeze+ them. */.conversation-topbar .ct-icon-btn,-.app-work-panel-toggle {+.app-work-panel-toggle,+.window-chrome-row .title-nav-btn {display: inline-flex;height: var(--ds-work-panel-toggle-size);width: var(--ds-work-panel-toggle-size);+ flex: 0 0 var(--ds-work-panel-toggle-size);align-items: center;justify-content: center;border: none;@@ -546,13 +538,15 @@}.conversation-topbar .ct-icon-btn:hover:not(:disabled),-.app-work-panel-toggle:hover:not(:disabled) {+.app-work-panel-toggle:hover:not(:disabled),+.window-chrome-row .title-nav-btn:hover:not(:disabled) {background: var(--ds-bg-hover);color: var(--ds-text-primary);}.conversation-topbar .ct-icon-btn:disabled,-.app-work-panel-toggle:disabled {+.app-work-panel-toggle:disabled,+.window-chrome-row .title-nav-btn:disabled {opacity: 0.4;cursor: default;}diff --git a/apps/desktop/src/styles/tokens.css b/apps/desktop/src/styles/tokens.cssindex fa0a47f7d..39814b7d2 100644--- a/apps/desktop/src/styles/tokens.css+++ b/apps/desktop/src/styles/tokens.css@@ -164,9 +164,13 @@--ds-work-panel-toggle-size: 28px;--ds-work-panel-toggle-inset: 12px;--ds-work-panel-toggle-gap: 20px;- /* Preview-mode shell actions are two 22px buttons with a 4px gap and an- additional 8px buffer before the panel's first tab. */- --ds-preview-action-lane-width: 56px;+ /* Preview-mode shell actions are two chrome controls (the same 28px square as+ the toggle beside them) with a 4px gap and an additional 8px buffer before+ the panel's first tab. Derived from the control it reserves room for, so the+ lane and the buttons cannot drift apart. */+ --ds-preview-action-lane-width: calc(+ 2 * var(--ds-work-panel-toggle-size) + 4px + 8px+ );/* Keep an 8px visual buffer between work-panel actions and window chrome. */--ds-window-controls-width: 120px;/* macOS traffic lights sit at the window's top-left. Their footprint isdiff --git a/apps/desktop/test/icon-button-square.test.mjs b/apps/desktop/test/chrome-control-geometry.test.mjssimilarity index 60%rename from apps/desktop/test/icon-button-square.test.mjsrename to apps/desktop/test/chrome-control-geometry.test.mjsindex cea27286d..f234cef19 100644--- a/apps/desktop/test/icon-button-square.test.mjs+++ b/apps/desktop/test/chrome-control-geometry.test.mjs@@ -1,10 +1,14 @@/**- * Icon-only control geometry.+ * Chrome control geometry.*- * `.icon-btn` is shared with label-driven pills, so its width comes from its- * content — glyph plus padding — and an icon-only use must state the square- * explicitly (`.icon-btn-square`). These are source contracts; the layout E2E- * measures the rendered rectangles.+ * Two families, one rule each:+ * - icon-only `.icon-btn` uses state the square explicitly (`.icon-btn-square`),+ * because `.icon-btn` is shared with label-driven pills and takes its width+ * from its content — glyph plus padding;+ * - the preview- and route-band lane actions take the shared chrome-control+ * geometry (`.ct-icon-btn` group) instead of restating their own size.+ *+ * These are source contracts; the layout E2E measures the rendered rectangles.*/import assert from "node:assert/strict";import { readFile } from "node:fs/promises";@@ -88,3 +92,34 @@ test("every icon-only .icon-btn states the square", async () => {}}});++test("the preview and route-band actions share the chrome control geometry", () => {+ // The topbar's dock toggle, the viewport-fixed panel toggle, and the lane+ // actions are the same control: one geometry, stated once.+ const shared = styles.match(/\.window-chrome-row \.title-nav-btn \{([^}]*)\}/)?.[1] ?? "";+ assert.ok(shared, "the shared chrome-control group does not cover the lane actions");+ assert.match(shared, /height:\s*var\(--ds-work-panel-toggle-size\)/);+ assert.match(shared, /width:\s*var\(--ds-work-panel-toggle-size\)/);+ // `flex: 0 0` keeps the control square when a crowded band squeezes it.+ assert.match(shared, /flex:\s*0 0 var\(--ds-work-panel-toggle-size\)/);+ assert.match(shared, /border-radius:\s*var\(--radius-md\)/);++ // The lane must not state its own size or seat again — that is what made it+ // render 22px wide next to 28px siblings.+ const lane = styles.match(/\n\.title-nav-btn \{([^}]*)\}/)?.[1] ?? "";+ assert.ok(lane, ".title-nav-btn rule is missing");+ for (const declaration of ["height", "width", "border-radius", "background"]) {+ assert.doesNotMatch(+ lane,+ new RegExp(`(^|\\s)${declaration}:`),+ `the lane restates ${declaration}, which the shared group owns`,+ );+ }+});++test("the preview action lane is derived from the control it reserves room for", () => {+ assert.match(+ styles,+ /--ds-preview-action-lane-width:\s*calc\(\s*2 \* var\(--ds-work-panel-toggle-size\)\s*\+\s*4px\s*\+\s*8px\s*\)/,+ );+});diff --git a/apps/desktop/test/renderer-branding.test.mjs b/apps/desktop/test/renderer-branding.test.mjsindex 076613ad3..1de2a5fbd 100644--- a/apps/desktop/test/renderer-branding.test.mjs+++ b/apps/desktop/test/renderer-branding.test.mjs@@ -101,6 +101,6 @@ test("app chrome uses the shared brand asset without branding the composer inputassert.doesNotMatch(composer, /infinity-mark|∞/);assert.match(sidebar, /<BrandLogo\s+size=\{20\}/);assert.match(sidebar, /IconNewSession/);- assert.match(app, /<IconNewSession\s+size=\{13\}/);+ assert.match(app, /<IconNewSession\s+size=\{15\}/);assert.doesNotMatch(sidebar, /IconCompose|IconPiMark|IconPiHome/);});