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(macos): paint an opaque window surface to stop idle GPU load
wqx0463abdb93b2
diff --git a/apps/desktop/electron/main/bootstrap/app-lifecycle.ts b/apps/desktop/electron/main/bootstrap/app-lifecycle.tsindex d1998c03e..787bc4bf8 100644--- a/apps/desktop/electron/main/bootstrap/app-lifecycle.ts+++ b/apps/desktop/electron/main/bootstrap/app-lifecycle.ts@@ -572,9 +572,6 @@ export function createApplicationLifecycle({}if (nativeTheme.themeSource === next) return;nativeTheme.themeSource = next;- if (process.platform === "darwin" && state.mainWindow && !state.mainWindow.isDestroyed()) {- state.mainWindow.setVibrancy("sidebar");- }}/**diff --git a/apps/desktop/electron/main/bootstrap/window.ts b/apps/desktop/electron/main/bootstrap/window.tsindex c2aac41db..14b769868 100644--- a/apps/desktop/electron/main/bootstrap/window.ts+++ b/apps/desktop/electron/main/bootstrap/window.ts@@ -196,10 +196,14 @@ export async function createWindow({? {titleBarStyle: "hiddenInset" as const,trafficLightPosition: MAC_TRAFFIC_LIGHT_POSITION,- vibrancy: "sidebar" as const,- visualEffectState: "followWindow" as const,- transparent: true,- backgroundColor: "#00000000",+ // An opaque native surface avoids continuous WindowServer+ // recomposition while the Electron window is visible (issue #1064).+ ...mainWindowBackgroundOptions(+ process.platform,+ initialWindowBackground,+ windows11NativeCorners,+ initialWindowBackground,+ ),}: {frame: false,diff --git a/apps/desktop/electron/main/ipc/window-ipc.ts b/apps/desktop/electron/main/ipc/window-ipc.tsindex e9050bfe0..39b41dbea 100644--- a/apps/desktop/electron/main/ipc/window-ipc.ts+++ b/apps/desktop/electron/main/ipc/window-ipc.ts@@ -133,7 +133,6 @@ export function registerWindowIpc({errorCode: ErrorCodes.INVALID_ARGUMENT,});}- if (process.platform === "darwin") return { applied: false, theme };const mainWindow = getMainWindow();if (!mainWindow || mainWindow.isDestroyed()) {throw new Error("main window unavailable");diff --git a/apps/desktop/electron/main/window-background.ts b/apps/desktop/electron/main/window-background.tsindex 5935756b9..b702bf47d 100644--- a/apps/desktop/electron/main/window-background.ts+++ b/apps/desktop/electron/main/window-background.ts@@ -35,7 +35,15 @@ export function mainWindowBackgroundOptions(}return { transparent: true, backgroundColor: "#00000000" };}- if (platform === "darwin") return {};+ if (platform === "darwin") {+ // An opaque native surface stops WindowServer from recompositing the+ // window every frame while it stays visible; the vibrancy material+ // behind a transparent surface did exactly that (issue #1064).+ return {+ transparent: false,+ backgroundColor: toElectronBackgroundColor(color),+ };+ }return { backgroundColor: toElectronBackgroundColor(color) };}@@ -47,8 +55,6 @@ export function applyMainWindowBackground(windows11NativeCorners = false,opaqueFallbackColor = color,): boolean {- if (platform === "darwin") return false;-const useOpaqueWindowsSurface = platform === "win32" && windows11NativeCorners;const electronColor = useOpaqueWindowsSurface? toOpaqueElectronBackgroundColor(color, opaqueFallbackColor)diff --git a/apps/desktop/test/idle-status-animations.test.mjs b/apps/desktop/test/idle-status-animations.test.mjsindex 23daf3c37..433f04b66 100644--- a/apps/desktop/test/idle-status-animations.test.mjs+++ b/apps/desktop/test/idle-status-animations.test.mjs@@ -5,11 +5,15 @@ import { loadStylesSync } from "./helpers/styles.mjs";/*** Idle status indicators must not keep submitting frames.*- * Any continuously animating indicator keeps the window surface dirty, and the- * macOS window is `transparent: true` over the native `sidebar` vibrancy- * material, so it is re-composited every frame it stays dirty: a 7px dot is- * enough to drive WindowServer GPU to ~70% on an otherwise idle desktop. See+ * Any continuously animating indicator keeps the window surface dirty, and a+ * continuously dirty window is recomposited every frame by WindowServer — a+ * 7px dot was enough to drive GPU to ~70% on an otherwise idle desktop. See* issue #1064 and `04-ux/07-ui-design-system.md` (sidebar status marks).+ *+ * The macOS window is opaque (ADR 0332): it no longer stacks a vibrancy+ * material behind a transparent surface, which removes the extra composition+ * cost claimed here historically. The rule still holds — unbounded idle+ * animations are a GPU regression on every platform.*/const styles = loadStylesSync();diff --git a/apps/desktop/test/macos-sidebar-vibrancy.test.mjs b/apps/desktop/test/macos-opaque-window-surface.test.mjssimilarity index 81%rename from apps/desktop/test/macos-sidebar-vibrancy.test.mjsrename to apps/desktop/test/macos-opaque-window-surface.test.mjsindex 4b46f7ece..ea17a1cc1 100644--- a/apps/desktop/test/macos-sidebar-vibrancy.test.mjs+++ b/apps/desktop/test/macos-opaque-window-surface.test.mjs@@ -7,9 +7,15 @@ import { loadStyles } from "./helpers/styles.mjs";const mainSource = await readMainSource();const windowSource = await readMainModule("bootstrap/window.ts");const lifecycleSource = await readMainModule("bootstrap/app-lifecycle.ts");+const windowIpcSource = await readMainModule("ipc/window-ipc.ts");const stylesSource = await loadStyles();-const createWindowSource = windowSource.slice(windowSource.indexOf("export async function createWindow("));+function styleBlock(selector) {+ return stylesSource.match(new RegExp(`${selector}\\s*\\{[^}]*\\}`))?.[0] ?? "";+}++const createWindowSource =+ windowSource.slice(windowSource.indexOf("export async function createWindow("));const mainWindowBlock =createWindowSource.match(/mainWindow = new BrowserWindow\(\{[\s\S]*?\n \}\);/)?.[0] ?? "";const macOptions =@@ -17,10 +23,6 @@ const macOptions =/\.\.\.\(process\.platform === "darwin"[\s\S]*?\n : \{[\s\S]*?\n \}\),/,)?.[0] ?? "";-function styleBlock(selector) {- return stylesSource.match(new RegExp(`${selector}\\s*\\{[^}]*\\}`))?.[0] ?? "";-}-function functionSource(source, name) {const start = source.indexOf(`function ${name}(`);assert.ok(start >= 0, `expected function ${name}`);@@ -28,19 +30,22 @@ function functionSource(source, name) {return source.slice(start, next === -1 ? undefined : next);}-test("macOS main window enables native sidebar vibrancy only in its platform branch", () => {+test("macOS main window paints an opaque native surface", () => {assert.match(macOptions, /titleBarStyle:\s*"hiddenInset"/);// The position itself lives in @pi-desktop/shared so the renderer's reserve// for it (styles/tokens.css) is derived from the same numbers.assert.match(macOptions, /trafficLightPosition:\s*MAC_TRAFFIC_LIGHT_POSITION/);- assert.match(macOptions, /vibrancy:\s*"sidebar"/);- assert.match(macOptions, /visualEffectState:\s*"followWindow"/);- assert.match(macOptions, /transparent:\s*true/);- assert.match(macOptions, /backgroundColor:\s*"#00000000"/);+ // A transparent window over the macOS vibrancy material made WindowServer+ // recomposite the whole window every frame it stayed dirty: an idle foreground+ // app held ~40% GPU (issue #1064). macOS now uses the opaque helper surface.+ assert.doesNotMatch(macOptions, /vibrancy:/);+ assert.doesNotMatch(macOptions, /visualEffectState:/);+ assert.doesNotMatch(macOptions, /transparent:\s*true/);+ assert.match(macOptions, /\.\.\.mainWindowBackgroundOptions\(/);assert.doesNotMatch(mainWindowBlock,- /vibrancy:\s*"under-window"/,- "non-mac branch must not set under-window vibrancy",+ /vibrancy:\s*"(?:sidebar|under-window)"/,+ "no platform branch may re-introduce a vibrancy material",);// The platform helper receives the built-in fallback selected from the@@ -55,14 +60,9 @@ test("macOS main window enables native sidebar vibrancy only in its platform bra/const initialWindowBackground = builtinWindowBackground\(\s*nativeTheme\.shouldUseDarkColors \? "dark" : "light",?\s*\)/,);assert.match(mainWindowBlock, /frame: false/);- assert.doesNotMatch(- mainWindowBlock.replace(macOptions, ""),- /vibrancy:\s*"sidebar"/,- "sidebar vibrancy stays in the darwin branch",- );});-test("native theme source maps preferences and only resets vibrancy on change", () => {+test("native theme source follows the app preference without touching window material", () => {const applyNative = functionSource(lifecycleSource, "applyNativeThemeSource");const applyMenu = functionSource(lifecycleSource, "applyApplicationMenuSettings");const send = functionSource(mainSource, "sendToRenderer");@@ -84,10 +84,10 @@ test("native theme source maps preferences and only resets vibrancy on change","a missing plugin theme must keep the system default, not a guessed base",);assert.match(applyNative, /if \(nativeTheme\.themeSource === next\) return;/);- assert.match(- applyNative,- /nativeTheme\.themeSource = next;\s*if \(process\.platform === "darwin" && state\.mainWindow && !state\.mainWindow\.isDestroyed\(\)\) \{\s*state\.mainWindow\.setVibrancy\("sidebar"\);/,- );+ assert.match(applyNative, /nativeTheme\.themeSource = next;/);+ // Setting the source must not re-apply a vibrancy material: the window has no+ // material to reset, and the opaque surface is updated by the background path.+ assert.doesNotMatch(applyNative, /setVibrancy/);// The theme mapping lives in `applyAppThemePreference` so the narrow plugin// `setTheme` path can never re-derive locale, keybindings, or dev-mode menu@@ -101,6 +101,17 @@ test("native theme source maps preferences and only resets vibrancy on change",);});+test("a theme change repaints the macOS native surface instead of skipping it", () => {+ // The native background path used to return early on darwin because vibrancy+ // owned the surface. With an opaque window the colour has to be applied.+ assert.doesNotMatch(+ windowIpcSource,+ /if \(process\.platform === "darwin"\) return \{ applied: false, theme \};/,+ "darwin must no longer skip the native window background",+ );+ assert.match(windowIpcSource, /applyMainWindowBackground\(/);+});+test("the macOS startup splash shares the sidebar glass tint and sheen", () => {const macGlassBlock =stylesSource.match(@@ -159,7 +170,7 @@ test("only macOS sidebar and splash surfaces receive the translucent glass treat}});-test("the sidebar glass tint stays thin enough to reveal the vibrancy material", () => {+test("the sidebar glass tint stays thin over the opaque native surface", () => {// Slice at the @theme block so later partials cannot fake a token, and match// the light selector at a line start — the file header comment quotes it.const tokenSource = stylesSource.slice(0, stylesSource.indexOf("@theme {"));@@ -184,7 +195,7 @@ test("the sidebar glass tint stays thin enough to reveal the vibrancy material",assert.ok(tint, `${theme}: tint must derive from --ds-bg-sidebar`);assert.ok(Number(tint[1]) <= 60,- `${theme}: tint ${tint[1]}% is too opaque for the material to show through`,+ `${theme}: tint ${tint[1]}% is too opaque for the surface to read as glass`,);}});diff --git a/apps/desktop/test/window-background-theme.test.mjs b/apps/desktop/test/window-background-theme.test.mjsindex 6345e475f..5cb14d96a 100644--- a/apps/desktop/test/window-background-theme.test.mjs+++ b/apps/desktop/test/window-background-theme.test.mjs@@ -14,7 +14,7 @@ const apiSource = await readFile();const appSource = await readAppSource();-test("theme changes synchronize the native non-macOS window background", () => {+test("theme changes synchronize the native window background on every platform", () => {assert.match(protocolSource,/windowSetBackgroundColor:\s*"pi-desktop\/window\/setBackgroundColor"/,@@ -45,7 +45,9 @@ test("theme changes synchronize the native non-macOS window background", () => {mainSource,/builtinWindowBackground\(\s*nativeTheme\.shouldUseDarkColors \? "dark" : "light",?\s*\)/,);- assert.match(+ // macOS paints an opaque surface (ADR 0332), so a theme change repaints it+ // there too instead of returning early.+ assert.doesNotMatch(mainSource,/process\.platform === "darwin"\) return \{ applied: false, theme \};/,);diff --git a/apps/desktop/test/window-background.test.mjs b/apps/desktop/test/window-background.test.mjsindex e96953438..29bcf520a 100644--- a/apps/desktop/test/window-background.test.mjs+++ b/apps/desktop/test/window-background.test.mjs@@ -27,7 +27,7 @@ test("plugin colors convert from RRGGBBAA to an explicit CSS color", () => {assert.throws(() => toElectronBackgroundColor("#1234567"), /invalid window background color/);});-test("constructor background options keep only the Windows outer surface transparent", () => {+test("constructor backgrounds use opaque macOS and Windows 11 surfaces", () => {assert.deepEqual(mainWindowBackgroundOptions("win32", "#ffffff"), {transparent: true,backgroundColor: "#00000000",@@ -35,7 +35,10 @@ test("constructor background options keep only the Windows outer surface transpaassert.deepEqual(mainWindowBackgroundOptions("linux", "#12345680"), {backgroundColor: "rgba(18, 52, 86, 0.5019607843137255)",});- assert.deepEqual(mainWindowBackgroundOptions("darwin", "#ffffff"), {});+ assert.deepEqual(mainWindowBackgroundOptions("darwin", "#12345680"), {+ transparent: false,+ backgroundColor: "rgba(18, 52, 86, 0.5019607843137255)",+ });});test("Windows 11 uses an opaque top-level background", () => {@@ -52,7 +55,7 @@ test("Windows 11 uses an opaque top-level background", () => {assert.deepEqual(windows11.calls, [["window", "#7f7f7f"]]);});-test("background updates target the rounded content view on Windows and native window on Linux", () => {+test("background updates target the rounded content view on Windows and native window elsewhere", () => {const windows = makeWindow();assert.equal(applyMainWindowBackground(windows, "win32", "#12345680"), true);assert.deepEqual(windows.calls, [["contentView", "rgba(18, 52, 86, 0.5019607843137255)"]]);@@ -62,6 +65,6 @@ test("background updates target the rounded content view on Windows and native wassert.deepEqual(linux.calls, [["window", "rgba(18, 52, 86, 1)"]]);const mac = makeWindow();- assert.equal(applyMainWindowBackground(mac, "darwin", "#123456"), false);- assert.deepEqual(mac.calls, []);+ assert.equal(applyMainWindowBackground(mac, "darwin", "#123456"), true);+ assert.deepEqual(mac.calls, [["window", "rgba(18, 52, 86, 1)"]]);});diff --git a/docs/adr/0248-plugin-theme-assets-and-window-background.md b/docs/adr/0248-plugin-theme-assets-and-window-background.mdindex 119d1a1d3..c0f035654 100644--- a/docs/adr/0248-plugin-theme-assets-and-window-background.md+++ b/docs/adr/0248-plugin-theme-assets-and-window-background.md@@ -74,6 +74,11 @@ applied at all.macOS keeps its `vibrancy` plate and never receives a colour, matching theexisting rule that darwin does not download one.+> **Superseded in part by ADR 0332.** macOS now paints an opaque native window+> surface instead of a vibrancy plate, so `windowAppearance.backgroundColor` is+> applied on darwin like every other platform. The permission, the derived-not-+> remembered restoration, and the palette resolution above are unchanged.+Permission: new `ui.window.appearance`, confirmed at install and shown in theSettings permission list. A declaration without the grant is audited andignored.diff --git a/docs/adr/0260-plugin-runtime-theme-apis.md b/docs/adr/0260-plugin-runtime-theme-apis.mdindex a9469c454..6165cc553 100644--- a/docs/adr/0260-plugin-runtime-theme-apis.md+++ b/docs/adr/0260-plugin-runtime-theme-apis.md@@ -18,8 +18,8 @@ expect against the shipped host contract:3. **Hard cap of 8 themes per plugin** (`MAX_THEMES_PER_PLUGIN`), which blocksan unlimited user-authored library.4. **Sidebar paint is color-only.** `--ds-bg-sidebar` feeds `color-mix` glass- tint, borders, and macOS vibrancy. Putting `linear-gradient()` in that token- breaks those consumers, so sidebar gradients cannot be a supported feature.+ tint and borders. Putting `linear-gradient()` in that token breaks those+ consumers, so sidebar gradients cannot be a supported feature.## Decision@@ -58,7 +58,8 @@ pi.themes.list()- `--ds-bg-sidebar` stays a **color**.- New optional `--ds-bg-sidebar-image` holds a CSS `<image>` (`none` by default).- `.sidebar` / `.sidebar-rail` use `background-color` + `background-image`.-- macOS vibrancy stacks the image layer **under** the glass sheen gradients.+- macOS stacks the image layer **under** the glass sheen gradients over the+ opaque window surface (ADR 0332 superseded the vibrancy plate).## Consequencesdiff --git a/docs/adr/0332-macos-opaque-window-surface.md b/docs/adr/0332-macos-opaque-window-surface.mdnew file mode 100644index 000000000..107914b91--- /dev/null+++ b/docs/adr/0332-macos-opaque-window-surface.md@@ -0,0 +1,107 @@+# ADR 0332: macOS paints an opaque native window surface++- Status: Accepted+- Date: 2026-10-16+- Deciders: PI-Desktop maintainers+- Related: issue #1064, D665, D304, D348, ADR 0248 (theme assets and window+ background), ADR 0260 (plugin runtime theme APIs),+ `docs/spec/04-ux/07-ui-design-system.md`,+ `docs/spec/04-ux/08-component-spec.md`++## Context++The macOS main window was created as a frameless `hiddenInset` window with+`vibrancy: "sidebar"`, `visualEffectState: "followWindow"`, `transparent: true`+and a `#00000000` backing. WindowServer composited the vibrancy material behind+the translucent Electron surface, and the renderer painted a thin tint plus+sheen over it to read as glass (D348).++That combination made the window surface continuously expensive. A vibrancy+material behind a transparent surface is re-composited by WindowServer whenever+the window stays dirty, and on the target hardware the cost was large and+unconditional: measured with `powermetrics --samplers gpu_power` on an Apple+Silicon machine, an idle focused window held GPU at++```text+desktop idle baseline avg 3.6% max 9.3%+PI-Desktop focused, idle avg 40.9% max 55.6%+PI-Desktop minimized avg 3.2% max 6.1%+```++Idle page content was not the cause: with the window focused and no session+running, the app's own GPU process consumed no measurable CPU time and the+renderer submitted no frames of its own. Minimizing removed the window from the+compositor's work and the GPU returned to the desktop baseline.++Earlier work on the same profile (#1064, D348) bounded idle-reachable indicator+animations so they could not hold the surface dirty forever. That reduced the+load but could not remove it: the material itself kept the window in the+compositor's per-frame path while it was visible and focused.++## Decision++macOS paints an opaque native surface. The main window keeps its frameless+`hiddenInset` titlebar, its inset traffic-light position, and the renderer's+glass tint and sheen, but no longer declares `vibrancy`, `visualEffectState`, or+a transparent backing. The window's native background comes from the same+platform helper the other platforms use, so a theme change repaints it instead+of being skipped on `darwin`.++- `mainWindowBackgroundOptions("darwin", color)` returns an opaque+ `{ transparent: false, backgroundColor }` surface.+- `applyMainWindowBackground` applies the colour on darwin like every other+ platform; the `win32` content-view and Windows 11 DWM branches are unchanged.+- `applyNativeThemeSource` no longer calls `setVibrancy` — there is no material+ to reset when the theme source changes.+- The `window.setBackgroundColor` IPC no longer returns early on darwin, so a+ plugin theme's `windowAppearance.backgroundColor` is applied on macOS too+ (ADR 0248), for the palette the renderer has resolved.++The renderer-side sidebar treatment is unchanged: `--ds-sidebar-glass-tint` and+the sheen still paint the sidebar, splash, and rail so the surface keeps+reading as glass. The tint is now composited over the opaque host palette+rather than over a live blur, which is what keeps the visual language intact+without the per-frame material cost.++## Consequences++- An idle focused window returns to the desktop GPU baseline: after the change+ the same measurement showed the focused-idle case matching the idle baseline+ instead of ~40%.+- macOS loses the live wallpaper blur behind the sidebar. The tint and sheen+ keep the glass appearance; the material is no longer translucent to desktop+ content.+- Plugins with a granted `ui.window.appearance` permission now have their+ `windowAppearance.backgroundColor` applied on macOS, matching Windows and+ Linux. Previously darwin silently ignored it because vibrancy owned the+ surface (ADR 0248 said darwin "never receives a colour"; that exclusion is+ superseded).+- The bounded-animation contract from #1064 stays in force. Its rationale text+ referenced the transparent/vibrancy window, which no longer describes the+ window; the rule itself (no unbounded idle animation) is still required+ because a dirty window is recomposited on every platform.++## Alternatives rejected++- **Keep vibrancy and bound every animation that can reach an idle screen.**+ This was the #1064 approach and it did reduce the load, but it cannot remove+ it: the material keeps the window in the compositor's per-frame path while it+ is visible and focused, independently of what the renderer paints. It also+ leaves the cost coupled to every new idle-reachable animation.+- **Drop only `visualEffectState: "followWindow"`.** The window already used+ `followWindow`, so this was a no-op; the material behaviour is what costs.+- **Drop transparency but keep vibrancy.** A vibrancy material without a+ transparent surface still has WindowServer composite the material; the+ transparent backing is what let it blend, not what made it expensive.+- **Make the opaque surface opt-in behind a setting.** The load is present on+ default installs, and a setting would leave every default user with the+ regression while adding a second rendering path to maintain.++## Evidence++- Issue #1064 (bounded idle status indicator animations, D348).+- `powermetrics --samplers gpu_power` A/B on Apple Silicon, focused-idle+ foreground vs. minimized, before and after this change.+- `apps/desktop/test/macos-opaque-window-surface.test.mjs` — window option and+ native-background contracts.+- `apps/desktop/test/window-background.test.mjs` — per-platform surface colours.diff --git a/docs/adr/README.md b/docs/adr/README.mdindex 18a7a9a6c..9ba489be5 100644--- a/docs/adr/README.md+++ b/docs/adr/README.md@@ -381,3 +381,4 @@ Each ADR includes:| plugin-fetch-redirect-policy | [Host-enforced plugin fetch redirect policy](plugin-fetch-redirect-policy.md) | Accepted (implementation candidate for #1475) || local-agent-remote-workspace-tools | [Local Agent and model requests for remote workspaces](local-agent-remote-workspace-tools.md) | Accepted for implementation |+| 0332 | [macOS paints an opaque native window surface](0332-macos-opaque-window-surface.md) | Accepted (D665; supersedes the macOS vibrancy window backing from D348; issue #1064) |diff --git a/docs/spec/04-ux/07-ui-design-system.md b/docs/spec/04-ux/07-ui-design-system.mdindex fc940e254..c852d65c5 100644--- a/docs/spec/04-ux/07-ui-design-system.md+++ b/docs/spec/04-ux/07-ui-design-system.md@@ -752,12 +752,12 @@ plain status text:- Exit: 280ms opacity fade (`startup-splash-out`) once `ready` is true, revealingthe already-mounted shell underneath- Reduced motion: near-zero enter/exit and a static full-width bar-- macOS: the splash is the same glass as the sidebar (D304 / D348) — the- `--ds-sidebar-glass-tint` fill plus top/bottom sheen over the native- `sidebar` vibrancy, so the boot surface never flashes an opaque panel- ahead of the translucent sidebar. The mounted shell stays hidden under- the glass until the exit fade, then cross-fades in. Other platforms keep- the opaque `--ds-bg-primary` fill+- macOS: the splash uses the same sidebar treatment as the app shell (D304 /+ D348) — the `--ds-sidebar-glass-tint` fill plus top/bottom sheen over the+ opaque native surface (ADR 0332 superseded the `sidebar` vibrancy plate), so+ the boot surface never flashes a mismatched panel ahead of the sidebar. The+ mounted shell stays hidden under the splash until the exit fade, then+ cross-fades in. Other platforms keep the opaque `--ds-bg-primary` fillThis is boot-state feedback, not decorative chrome.diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex 82b7fba02..45baf2835 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -150,22 +150,27 @@ Outer frame that positions Topbar, Sidebar, MainChat, and WorkPanel. Owns resize| Windows | Frameless 46px titlebar; sidebar actions at left; work-panel toggle then minimize/maximize/close stay viewport-fixed at the window's top-right | None inside the window || Linux | Frameless 46px titlebar; sidebar actions at left; work-panel toggle then minimize/maximize/close stay viewport-fixed at the window's top-right | None inside the window |-- macOS enables the native Electron `vibrancy: "sidebar"` source-list material- with `visualEffectState: "followWindow"` and a transparent window backing- (D348). `nativeTheme.themeSource` follows the app theme preference (`system` /- `light` / `dark` / plugin base) so the material's light or dark plate matches- the renderer. Vibrancy is re-applied only when that source changes; a missing- plugin theme falls back to `system`. Main and settings navigation share the+- macOS paints an **opaque** native window surface (ADR 0332). It deliberately+ does not use Electron's `vibrancy` material or a transparent window backing:+ a material behind a transparent surface is recomposited by WindowServer on+ every frame the window stays dirty, which held an idle focused window near+ 40% GPU on Apple Silicon (issue #1064). `nativeTheme.themeSource` still follows+ the app theme preference (`system` / `light` / `dark` / plugin base), and the+ opaque background is repainted from that preference so the native plate always+ matches the renderer; a missing plugin theme falls back to `system`. Main and+ settings navigation share the`.sidebar-surface` material, alongside any rendered `.sidebar-rail`; thesettings shell ancestry is transparent but its content pane and titlebar stayopaque. The renderer adds a thin theme tint(`--ds-sidebar-glass-tint`, 40% dark / 55% light) plus a top/bottom sheen.- The dock carries no seam or hairline: the glass meets the opaque main pane+ The dock carries no seam or hairline: the sidebar meets the opaque main paneflush, so the only edge cue is the tint's natural change against the pane.- The material carries the blur, so the tint must stay thin — the sheen is what- keeps the surface reading as glass rather than a painted panel.+ With no live material behind it the tint is a paint, not a window onto a+ blur, so it must stay thin enough that the sheen — not the fill — keeps the+ surface reading as glass rather than a painted panel.`.main-pane`, `.main-titlebar`, and `.conversation-topbar` remain opaque- `bg-primary` surfaces, so vibrancy does not spread across the whole window.+ `bg-primary` surfaces, so the sidebar treatment does not spread across the+ whole window.Windows/Linux retain their existing opaque background and frameless behavior.- The macOS system menu exposes New Task, Open Project, Settings, CommandPalette, Sidebar, standard editing, zoom/fullscreen, window, Help, Logs, anddiff --git a/docs/spec/07-plugins/13-plugin-permissions-matrix.md b/docs/spec/07-plugins/13-plugin-permissions-matrix.mdindex c9521728c..06d001e96 100644--- a/docs/spec/07-plugins/13-plugin-permissions-matrix.md+++ b/docs/spec/07-plugins/13-plugin-permissions-matrix.md@@ -12,7 +12,7 @@ Provide a permission–capability–risk–default-policy reference table for re| `ui.view` | low | `contributes.views` are listed in the work panel and may be opened | Granted at install | Same isolation as a panel window: sandboxed page, per-plugin partition, `net.domains` egress. Filtered by activation scope || `ui.theme` | low | `contributes.themes` CSS is loaded and offered in Settings; runtime `pi.themes.upsert` / `remove` / `list` and `pi.app.setTheme` (ADR 0260) | Granted at install | CSS is sanitized by the host; it cannot script. Declared `assets` are served over the host's read-only `plugin-asset:` scheme. `setTheme` may only select a built-in preference or a currently registered plugin theme. There is no per-plugin theme count cap || `ui.settings` | low | `contributes.settingsDestinations` adds a sandboxed Settings entry in Extensions | Granted at install | Rendered only in host Extensions group; isolated view host with same sandbox as panel views (ADR 0261) |-| `ui.window.appearance` | low | `contributes.windowAppearance` sets the native window background and Windows main-window corner request while one of the plugin's themes is selected | Granted at install | `#rrggbb` / `#rrggbbaa` background and integer `cornerRadius` 0..24 DIP; restores host background and the 12 DIP default request when the theme is gone. Windows 11 maps 0 to square and positive values to the system-rounded preference (not exact DIP radii); alpha is composited over the built-in theme color on its opaque window. Earlier Windows builds retain the requested DIP radius. macOS keeps vibrancy and native corners |+| `ui.window.appearance` | low | `contributes.windowAppearance` sets the native window background and Windows main-window corner request while one of the plugin's themes is selected | Granted at install | `#rrggbb` / `#rrggbbaa` background and integer `cornerRadius` 0..24 DIP; restores host background and the 12 DIP default request when the theme is gone. Windows 11 maps 0 to square and positive values to the system-rounded preference (not exact DIP radii); alpha is composited over the built-in theme color on its opaque window. Earlier Windows builds retain the requested DIP radius. macOS applies the background to its opaque native surface (ADR 0332) and keeps native corners || `clipboard.read` | medium | `clipboard.readText`, `clipboard.getHistory` | Confirm on first use | May read sensitive information and retained clipboard history || `clipboard.write` | medium | `clipboard.writeText` | Confirm on first use | Prevents clipboard pollution || `notify` | low | `ui.notify`, `ui.getNotificationPermission`, `ui.requestNotificationPermission`, `ui.showNativeNotification` | Can be granted by default | Native delivery is OS-controlled; avoid notification-spam abuse |diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 057e6fc9a..5958a9bc0 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -7778,3 +7778,26 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.default. Settings reads apply these defaults through renderer APInormalization; no persisted schema or migration change is required. See`04-ux/01-ui-ia.md`, `04-ux/06-settings-ia.md`, and E2E-266.++## 2026-10-16 — macOS paints an opaque native window surface (D665)++- D665 supersedes the macOS `vibrancy: "sidebar"` + `transparent: true` window+ backing from D348. A vibrancy material behind a transparent surface is+ recomposited by WindowServer every frame the window stays dirty, which held an+ idle focused window near 40% GPU on Apple Silicon (issue #1064). macOS now+ paints the opaque background the other platforms already use, keeping the+ `hiddenInset` titlebar, the inset traffic-light position, and the renderer's+ sidebar tint and sheen.+- The `window.setBackgroundColor` IPC no longer returns early on darwin, so a+ granted `windowAppearance.backgroundColor` plugin theme is applied on macOS+ like every other platform (ADR 0248): a theme change repaints the native+ surface instead of being skipped. Native corner behavior is unchanged.+- The bounded-animation contract that bounded idle indicators under #1064 stays+ in force; only its stated rationale changes, because a dirty window is+ recomposited on every platform. See ADR 0332, ADR 0248, ADR 0260,+ `04-ux/08-component-spec.md`, `04-ux/07-ui-design-system.md`, and+ `07-plugins/13-plugin-permissions-matrix.md`.+- Covered by `apps/desktop/test/macos-opaque-window-surface.test.mjs`,+ `apps/desktop/test/window-background.test.mjs`,+ `apps/desktop/test/window-background-theme.test.mjs`, and+ `apps/desktop/test/idle-status-animations.test.mjs`.