Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(webgl): macOS defaults to the DOM renderer — WebGL becomes a deliberate opt-in

enes1890ed09abdf
diff --git a/src/core/settings-store.test.ts b/src/core/settings-store.test.ts
index bb0cb9358..b6e442e0e 100644
--- a/src/core/settings-store.test.ts
+++ b/src/core/settings-store.test.ts
@@ -63,9 +63,40 @@ describe('SettingsStore nested-default merge', () => {
expect(store.get().speech).toEqual(DEFAULT_SETTINGS.speech)
})
- it('defaults everything when settings.json does not exist', () => {
+ it("defaults everything when settings.json does not exist", () => {
const store = new SettingsStore()
store.init()
expect(store.get()).toEqual(DEFAULT_SETTINGS)
})
+
+ describe('legacy terminalGpuRendering boolean migration', () => {
+ const load = (value: unknown): SettingsStore => {
+ writeFileSync(
+ path.join(dir, 'settings.json'),
+ JSON.stringify({ terminalGpuRendering: value }),
+ 'utf-8'
+ )
+ const store = new SettingsStore()
+ store.init()
+ return store
+ }
+
+ it("migrates an explicit legacy false (escape-hatch choice) to 'off'", () => {
+ expect(load(false).get().terminalGpuRendering).toBe('off')
+ })
+
+ it("migrates a legacy true (indistinguishable from the old merged default) to 'auto'", () => {
+ expect(load(true).get().terminalGpuRendering).toBe('auto')
+ })
+
+ it('keeps modern string values as-is', () => {
+ expect(load('on').get().terminalGpuRendering).toBe('on')
+ expect(load('off').get().terminalGpuRendering).toBe('off')
+ expect(load('auto').get().terminalGpuRendering).toBe('auto')
+ })
+
+ it("normalizes garbage to 'auto'", () => {
+ expect(load('warp-speed').get().terminalGpuRendering).toBe('auto')
+ })
+ })
})
diff --git a/src/core/settings-store.ts b/src/core/settings-store.ts
index 0db07d2ce..a0f8e1557 100644
--- a/src/core/settings-store.ts
+++ b/src/core/settings-store.ts
@@ -15,6 +15,14 @@ import { DEFAULT_SETTINGS, type Settings } from '../shared/types'
function mergeSettings(saved: Partial<Settings> | null | undefined): Settings {
const merged = { ...DEFAULT_SETTINGS, ...saved }
merged.speech = { ...DEFAULT_SETTINGS.speech, ...saved?.speech }
+ // Legacy `terminalGpuRendering` was a boolean whose default (true) was merged into every saved
+ // file — so a stored `true` is indistinguishable from "never touched" and maps to the new
+ // 'auto' (platform-aware) default, while a stored `false` was always an explicit escape-hatch
+ // choice and stays 'off'. See the field's doc in shared/types.ts.
+ const gpu = (saved as { terminalGpuRendering?: unknown } | null | undefined)
+ ?.terminalGpuRendering
+ if (gpu === false) merged.terminalGpuRendering = 'off'
+ else if (gpu !== 'on' && gpu !== 'off' && gpu !== 'auto') merged.terminalGpuRendering = 'auto'
return merged
}
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index ed58c36fb..6562c30f7 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -7,14 +7,18 @@ import { localSession } from './session/localSession'
import { useSettings } from './state/settings'
import { useViewMode } from './state/viewMode'
import { setWebglEnabled } from './terminal/webgl-budget'
+import { resolveGpuRendering } from '../shared/webgl'
+import { isMacPlatform } from '../shared/platform-utils'
export default function App() {
- // Apply the GPU-terminal-rendering toggle to the WebGL budget coordinator, live. Off reclaims
- // every context (terminals fall back to the DOM renderer) — the escape hatch for the macOS
- // compositor-flicker case. Subscribed at the root so it holds whatever view is showing.
+ // Apply the GPU-terminal-rendering setting to the WebGL budget coordinator, live. 'auto'
+ // resolves per platform (macOS → DOM renderer: the compositor-level black/flicker failures
+ // have only ever been observed there, and a public default must be the field-proven-clean
+ // configuration; WebGL on a Mac is a deliberate 'on'). Off reclaims every context.
+ // Subscribed at the root so it holds whatever view is showing.
const gpu = useSettings((s) => s.settings.terminalGpuRendering)
useEffect(() => {
- setWebglEnabled(gpu !== false)
+ setWebglEnabled(resolveGpuRendering(gpu, isMacPlatform()))
}, [gpu])
// Keep the view-mode store's default in sync with the Settings choice, so projects the user
diff --git a/src/renderer/components/settings/sections/TerminalSection.tsx b/src/renderer/components/settings/sections/TerminalSection.tsx
index 054cc30db..73d267e12 100644
--- a/src/renderer/components/settings/sections/TerminalSection.tsx
+++ b/src/renderer/components/settings/sections/TerminalSection.tsx
@@ -5,6 +5,8 @@ import { FieldRow } from '../FieldRow'
import { Input } from '@renderer/ui/Input'
import { Switch } from '@renderer/ui/Switch'
import { NumberField } from '@renderer/ui/NumberField'
+import { resolveGpuRendering } from '@shared/webgl'
+import { isMacPlatform } from '@shared/platform-utils'
const ROWS = {
fontSize: { title: 'Font size', keywords: ['font', 'size', 'text'] },
@@ -62,11 +64,15 @@ export function TerminalSection({ isActive }: { isActive: boolean }): React.JSX.
<SearchableRow {...ROWS.gpu}>
<FieldRow
label="GPU terminal rendering"
- description="Turn off if the window flickers. Terminals then use the DOM renderer (no WebGL)."
+ description={
+ isMacPlatform()
+ ? 'Off by default on macOS (WebGL terminals can flicker or composite black there). Turning it on is an explicit opt-in.'
+ : 'Turn off if the window flickers. Terminals then use the DOM renderer (no WebGL).'
+ }
control={
<Switch
- checked={settings.terminalGpuRendering !== false}
- onChange={(v) => update({ terminalGpuRendering: v })}
+ checked={resolveGpuRendering(settings.terminalGpuRendering, isMacPlatform())}
+ onChange={(v) => update({ terminalGpuRendering: v ? 'on' : 'off' })}
ariaLabel="GPU terminal rendering"
/>
}
diff --git a/src/shared/types.ts b/src/shared/types.ts
index a34856297..57949ef17 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -707,10 +707,15 @@ export interface Settings {
canvasDragMode: 'select' | 'pan'
accent: string
tmuxEnabled: boolean
- /** GPU (WebGL) terminal rendering. Off routes every terminal to xterm's DOM renderer — an escape
- * hatch for machines where many live WebGL contexts destabilize the OS compositor (whole-window
- * flicker on some macOS GPUs). Default on. */
- terminalGpuRendering: boolean
+ /** GPU (WebGL) terminal rendering. 'off' routes every terminal to xterm's DOM renderer.
+ * 'auto' (default) = on everywhere EXCEPT macOS: repeated field reports there (whole-window
+ * flicker; terminals compositing black after renderer swaps, with zero JS-visible errors)
+ * point at the OS compositor mishandling live WebGL canvases — the only field-proven-clean
+ * configuration on those machines is the DOM renderer, so macOS gets it by default and WebGL
+ * stays a deliberate opt-in ('on'). Legacy boolean values are migrated on load: `false` (an
+ * explicit escape-hatch choice) → 'off'; `true` (indistinguishable from the old merged-in
+ * default) → 'auto'. */
+ terminalGpuRendering: 'auto' | 'on' | 'off'
tmuxScrollback: number
/** AI commit message agent: a local coding-agent CLI run read-only. */
commitAgent: 'claude' | 'codex' | 'custom'
@@ -830,7 +835,7 @@ export const DEFAULT_SETTINGS: Settings = {
canvasDragMode: 'select',
accent: '#0a84ff',
tmuxEnabled: true,
- terminalGpuRendering: true,
+ terminalGpuRendering: 'auto',
tmuxScrollback: 50000,
commitAgent: 'claude',
commitAgentCommand: '',
diff --git a/src/shared/webgl.ts b/src/shared/webgl.ts
index bff004b1f..efd8709f9 100644
--- a/src/shared/webgl.ts
+++ b/src/shared/webgl.ts
@@ -33,3 +33,20 @@ export const WEBGL_BUDGET_DESKTOP = 24
* compositing handles reliably.
*/
export const WEBGL_BUDGET_DESKTOP_MAC = 10
+
+/**
+ * Resolve the `terminalGpuRendering` setting to an effective on/off. 'auto' (the default) is on
+ * everywhere EXCEPT macOS: the compositor-level failures above have only ever been observed
+ * there, the DOM renderer is the one field-proven-clean configuration on those machines, and a
+ * public default must be the proven one — WebGL on a Mac is a deliberate 'on'. Renderer-side
+ * only (platform detection is navigator-based). Legacy booleans still resolve sanely if one
+ * slips past the settings-store migration.
+ */
+export function resolveGpuRendering(
+ value: 'auto' | 'on' | 'off' | boolean | undefined,
+ isMac: boolean
+): boolean {
+ if (value === 'on' || value === true) return true
+ if (value === 'off' || value === false) return false
+ return !isMac
+}