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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(settings): make the tab bar height a setting (Settings → Appearance)
enesed5f41d4bb5b
diff --git a/CLAUDE.md b/CLAUDE.mdindex 277b92f9e..1ce5bfc0d 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -4055,7 +4055,14 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord meapopover position against it) and `TABBAR_HEIGHT_PX` in `@shared/window-chrome-metrics`, fromwhich main derives the traffic-light `y` (`trafficLightY`) — a literal 15 for a 44px bar waswhat made shrinking the bar hazardous. It is **40px** (36 for one release, which read as cramped- once the tabs carried whole names). `styles.tabbar.test.ts` pins the token to the constant and+ once the tabs carried whole names) **by default — the height is a SETTING**+ (`settings.tabBarHeight`, Settings → Appearance, 28–64): `App.tsx` writes the resolved value to+ `--tabbar-h` on `<html>`, and main re-centres the macOS traffic lights on the same settings+ change (`win.setWindowButtonPosition(trafficLightPositionFor(h))`, change-gated), so the two+ cannot disagree. Every reader goes through `resolveTabBarHeight`, which answers the default for+ a non-number and clamps — the floor is what keeps the 12px lights inside the bar. The stylesheet+ token keeps the default LITERAL so an un-hydrated renderer draws the default bar, not none.+ `styles.tabbar.test.ts` pins the token to the constant andevery dependant to the token. The New-project `+` is a **sibling** of `.tabbar__tabs`, not its last child — insidethe scroller it vanished once the strip overflowed (no visible scrollbar to hint it wasstill there). The wrapping `.tabbar__projects` is `flex: 1` and stays a drag region (notdiff --git a/docs/assets/tabbar-height-28.png b/docs/assets/tabbar-height-28.pngnew file mode 100644index 000000000..9147a2821Binary files /dev/null and b/docs/assets/tabbar-height-28.png differdiff --git a/docs/assets/tabbar-height-40.png b/docs/assets/tabbar-height-40.pngnew file mode 100644index 000000000..f02727743Binary files /dev/null and b/docs/assets/tabbar-height-40.png differdiff --git a/docs/assets/tabbar-height-56.png b/docs/assets/tabbar-height-56.pngnew file mode 100644index 000000000..aa90bd270Binary files /dev/null and b/docs/assets/tabbar-height-56.png differdiff --git a/src/main/index.ts b/src/main/index.tsindex d21e7bfe6..db1f4f1b0 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -19,7 +19,8 @@ import { writeFilesToClipboard } from './clipboard-files'import { pickProjectIcon } from './project-icon-upload'import { allowGuestNavigation } from './webview-nav'import { hostOsFromPlatform, sshServerCopy } from '../shared/ssh-server'-import { macTitleBarOptions } from './window-chrome'+import { macTitleBarOptions, trafficLightPositionFor } from './window-chrome'+import { resolveTabBarHeight } from '@shared/window-chrome-metrics'import { guestContextMenuTemplate } from './webview-context-menu'import { BrowserControlLedger } from './browser-control-ledger'import {@@ -990,7 +991,9 @@ function createWindow(): BrowserWindow {// macOS-only in Electron, and the renderer's tab bar reserves its 86px of left padding for// exactly this window shape — so state the platform here rather than leaving it to Electron to// ignore the values elsewhere (issue #564). Windows/Linux keep their native frame, unchanged.- ...macTitleBarOptions(process.platform),+ // The lights are centred on the user's tab-bar height (Settings → Appearance); a later change+ // re-centres them live through the `settingsStore.onChange` hook below.+ ...macTitleBarOptions(process.platform, resolveTabBarHeight(settingsStore.get().tabBarHeight)),webPreferences: {preload: join(__dirname, '../preload/index.js'),contextIsolation: true,@@ -2003,10 +2006,19 @@ app.whenReady().then(async () => {// any future live label) tracks the renderer's setting. The renderer is the sole settings// writer; a change persists through `settingsStore`, which fires this hook. No reverse IPC.// Keep-awake re-reads its enable flag on the same edge.- settingsStore.onChange(() => {+ // The traffic lights sit INSIDE the tab bar on macOS, so a bar-height change re-centres them —+ // a bar that shrinks under lights left at the old y looks broken at once. Change-gated: the+ // hook fires on every settings write and the position call is a native round trip.+ let trafficLightBarHeight = resolveTabBarHeight(settingsStore.get().tabBarHeight)+ settingsStore.onChange((s) => {applyNotchHudSettings(notchTunables())buildAppMenu(win)keepAwake?.refresh()+ const barHeight = resolveTabBarHeight(s.tabBarHeight)+ if (barHeight !== trafficLightBarHeight && process.platform === 'darwin' && !win.isDestroyed()) {+ trafficLightBarHeight = barHeight+ win.setWindowButtonPosition(trafficLightPositionFor(barHeight))+ }})// Keep awake while agents work (docs/superpowers/specs/2026-08-18-keep-awake-design.md): hold an// idle-sleep power assertion while a LOCAL agent node is working, released the moment the lastdiff --git a/src/main/window-chrome.test.ts b/src/main/window-chrome.test.tsindex f0e65b4ad..cfe846377 100644--- a/src/main/window-chrome.test.ts+++ b/src/main/window-chrome.test.ts@@ -1,8 +1,11 @@import { describe, expect, it } from 'vitest'-import { macTitleBarOptions } from './window-chrome'+import { macTitleBarOptions, trafficLightPositionFor } from './window-chrome'import {+ TABBAR_HEIGHT_MAX_PX,+ TABBAR_HEIGHT_MIN_PX,TABBAR_HEIGHT_PX,TRAFFIC_LIGHT_DIAMETER_PX,+ resolveTabBarHeight,trafficLightY} from '@shared/window-chrome-metrics'@@ -24,6 +27,13 @@ describe('macTitleBarOptions', () => {expect(trafficLightY(36)).toBe(12)})+ it("follows the user's bar height, at creation and for the live re-centre", () => {+ expect(macTitleBarOptions('darwin', 44).trafficLightPosition).toEqual({ x: 16, y: 16 })+ expect(macTitleBarOptions('darwin', 28).trafficLightPosition).toEqual({ x: 16, y: 8 })+ // The live path (`setWindowButtonPosition`) and the constructor path are one function.+ expect(trafficLightPositionFor(44)).toEqual(macTitleBarOptions('darwin', 44).trafficLightPosition)+ })+// Issue #564: both options are macOS-only. Claiming them elsewhere is what made the renderer's// 86px traffic-light reservation look justified on a window that has a native frame.it('claims neither on Windows or Linux', () => {@@ -31,3 +41,20 @@ describe('macTitleBarOptions', () => {expect(macTitleBarOptions('linux')).toEqual({})})})++describe('resolveTabBarHeight', () => {+ it('answers the default for anything that is not a finite number (every pre-feature settings.json)', () => {+ for (const v of [undefined, null, '', '40', Number.NaN, Number.POSITIVE_INFINITY, {}]) {+ expect(resolveTabBarHeight(v)).toBe(TABBAR_HEIGHT_PX)+ }+ })++ it('clamps and rounds a number, so a hand-edited value can never hide the bar or strand the lights', () => {+ expect(resolveTabBarHeight(44)).toBe(44)+ expect(resolveTabBarHeight(43.6)).toBe(44)+ expect(resolveTabBarHeight(4)).toBe(TABBAR_HEIGHT_MIN_PX)+ expect(resolveTabBarHeight(400)).toBe(TABBAR_HEIGHT_MAX_PX)+ // The floor keeps the 12px lights an 8px margin; the lights are never placed above the bar.+ expect(trafficLightY(TABBAR_HEIGHT_MIN_PX)).toBeGreaterThanOrEqual(8)+ })+})diff --git a/src/main/window-chrome.ts b/src/main/window-chrome.tsindex 55dd30508..795f470c2 100644--- a/src/main/window-chrome.ts+++ b/src/main/window-chrome.ts@@ -1,5 +1,5 @@import type { BrowserWindowConstructorOptions } from 'electron'-import { TRAFFIC_LIGHT_X, trafficLightY } from '@shared/window-chrome-metrics'+import { TABBAR_HEIGHT_PX, TRAFFIC_LIGHT_X, trafficLightY } from '@shared/window-chrome-metrics'/*** The window-frame options that only mean something on macOS.@@ -12,14 +12,21 @@ import { TRAFFIC_LIGHT_X, trafficLightY } from '@shared/window-chrome-metrics'** The lights' `y` is DERIVED from the bar height (`@shared/window-chrome-metrics`), not typed* here: it was a literal 15 for a 44px bar, and shrinking the bar to Chrome's proportions would- * have left them hanging below its centre.+ * have left them hanging below its centre. `barHeight` is the user's resolved+ * `settings.tabBarHeight`; the same function answers the live re-centre when the setting changes+ * (`BrowserWindow.setWindowButtonPosition`, macOS only).*/+export function trafficLightPositionFor(barHeight: number = TABBAR_HEIGHT_PX): { x: number; y: number } {+ return { x: TRAFFIC_LIGHT_X, y: trafficLightY(barHeight) }+}+export function macTitleBarOptions(- platform: NodeJS.Platform+ platform: NodeJS.Platform,+ barHeight: number = TABBAR_HEIGHT_PX): Pick<BrowserWindowConstructorOptions, 'titleBarStyle' | 'trafficLightPosition'> {if (platform !== 'darwin') return {}return {titleBarStyle: 'hiddenInset',- trafficLightPosition: { x: TRAFFIC_LIGHT_X, y: trafficLightY() }+ trafficLightPosition: trafficLightPositionFor(barHeight)}}diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex ca8e15c9c..6b0dc83c9 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -16,6 +16,7 @@ import { useSharedGlyph } from './canvas/SharedGlyphLayer'import { resolveTerminalRenderer } from '../shared/webgl'import { resolveTerminalTheme } from './terminal/themes'import { resolveUiScale } from '../shared/ui-scale'+import { resolveTabBarHeight } from '../shared/window-chrome-metrics'import { useAppTheme } from './state/useAppTheme'import { installWindowActivityOnDocument } from './lib/windowActivity'@@ -45,6 +46,16 @@ export default function App() {if (background) document.documentElement.style.setProperty('--term-bg', background)}, [terminalTheme])+ // The tab bar's height is a setting (Settings → Appearance). Everything positioned against the+ // bar reads the `--tabbar-h` token, so publishing the resolved value on <html> is the whole+ // renderer side; main re-centres the macOS traffic lights from the same setting. The token's+ // stylesheet default (`TABBAR_HEIGHT_PX`) stands until this runs, so a not-yet-hydrated+ // settings store draws the default bar rather than none.+ const tabBarHeight = useSettings((s) => s.settings.tabBarHeight)+ useEffect(() => {+ document.documentElement.style.setProperty('--tabbar-h', `${resolveTabBarHeight(tabBarHeight)}px`)+ }, [tabBarHeight])+// Hold every infinite CSS animation still while nobody is looking at this window (the gate is// `--nt-anim-state` / `[data-nt-window]` in styles.css, where the measurements live). Installed// here rather than in Canvas because the surfaces that animate outside the canvas — thediff --git a/src/renderer/components/settings/sections/AppearanceSection.tsx b/src/renderer/components/settings/sections/AppearanceSection.tsxindex e43840d35..832723cd6 100644--- a/src/renderer/components/settings/sections/AppearanceSection.tsx+++ b/src/renderer/components/settings/sections/AppearanceSection.tsx@@ -15,6 +15,13 @@ import { cn } from '@renderer/ui/cn'import { Select } from '@renderer/ui/Select'import { isBrowserRuntime } from '@renderer/bridge/runtime'import { UI_SCALE_CHOICES, resolveUiScale, uiScaleLabel } from '@shared/ui-scale'+import {+ TABBAR_HEIGHT_MAX_PX,+ TABBAR_HEIGHT_MIN_PX,+ TABBAR_HEIGHT_PX,+ resolveTabBarHeight+} from '@shared/window-chrome-metrics'+import { NumberField } from '@renderer/ui/NumberField'import { SectionReset } from '../SectionReset'import { APPEARANCE_RESET_KEYS } from '@renderer/lib/settingsReset'@@ -27,6 +34,10 @@ const ROWS = {title: 'UI scale',keywords: ['ui', 'scale', 'zoom', 'size', 'text', 'bigger', 'larger', '4k', 'hidpi', 'dpi', 'display', 'readability']},+ tabBarHeight: {+ title: 'Tab bar height',+ keywords: ['tab', 'bar', 'height', 'strip', 'top', 'title bar', 'thickness', 'compact', 'dense']+ },accent: { title: 'Accent', keywords: ['accent', 'color', 'theme', 'appearance'] },windowTitle: {title: 'Window title',@@ -150,6 +161,38 @@ function UiScaleRow(): React.JSX.Element {)}+/** The top project tab bar's height, in px. A number field rather than presets: the requests+ * that prompted it were "a bit shorter" and "a bit taller", and a preset list would have to guess+ * where those land. The traffic lights follow where they sit inside the bar (main re-centres+ * them on the same setting); everything positioned against the bar reads its token, so nothing+ * else moves. The copy names no platform: `machineName.guard.test.ts` forbids "Mac" in+ * user-visible renderer strings, and a browser viewer's OS says nothing about the server's. */+function TabBarHeightRow(): React.JSX.Element {+ const tabBarHeight = useSettings((s) => s.settings.tabBarHeight)+ const update = useSettings((s) => s.update)+ const resolved = resolveTabBarHeight(tabBarHeight)+ return (+ <FieldRow+ label="Tab bar height"+ htmlFor="tab-bar-height"+ description={`Height of the top project tab bar, in pixels (${TABBAR_HEIGHT_MIN_PX}–${TABBAR_HEIGHT_MAX_PX}; default ${TABBAR_HEIGHT_PX}). The tabs follow it, and so do the window buttons where they sit inside the bar.`}+ control={+ <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>+ <NumberField+ value={resolved}+ min={TABBAR_HEIGHT_MIN_PX}+ max={TABBAR_HEIGHT_MAX_PX}+ step={2}+ ariaLabel="Tab bar height"+ onChange={(v) => update({ tabBarHeight: resolveTabBarHeight(v) })}+ />+ <span style={{ opacity: 0.6 }}>px</span>+ </div>+ }+ />+ )+}+export function AppearanceSection({ isActive }: { isActive: boolean }): React.JSX.Element {const appTheme = useSettings((s) => s.settings.appTheme)const accent = useSettings((s) => s.settings.accent)@@ -186,6 +229,9 @@ export function AppearanceSection({ isActive }: { isActive: boolean }): React.JS<SearchableRow {...ROWS.uiScale}><UiScaleRow /></SearchableRow>+ <SearchableRow {...ROWS.tabBarHeight}>+ <TabBarHeightRow />+ </SearchableRow><SearchableRow {...ROWS.accent}><div className="flex items-center justify-between gap-4 py-2.5"><span className="text-[13px] text-text">Accent</span>diff --git a/src/renderer/lib/settingsReset.ts b/src/renderer/lib/settingsReset.tsindex 303e6e134..140d5ed39 100644--- a/src/renderer/lib/settingsReset.ts+++ b/src/renderer/lib/settingsReset.ts@@ -35,6 +35,7 @@ export const TERMINAL_RESET_KEYS = [export const APPEARANCE_RESET_KEYS = ['appTheme','uiScale',+ 'tabBarHeight','accent','hiddenNodeMenuItems','hiddenHeaderButtons',diff --git a/src/shared/types.ts b/src/shared/types.tsindex 6411e5473..d473d4783 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -1,5 +1,6 @@// Types shared across the main, preload, and renderer processes.+import { TABBAR_HEIGHT_PX } from './window-chrome-metrics'import { DEFAULT_WORKTREE_PATH_TEMPLATE } from './worktree'import type { CloneProgress } from './clone-url'import type { KeybindingOverrides, TerminalShortcutPolicy } from './keybindings'@@ -1429,6 +1430,12 @@ export interface Settings {* Distinct from `snapToGrid` (drag-time snap) — turning this on arranges once; it does not* constrain future drags. v1: arrange-all-on-enable only. */autoAlignGrid: boolean+ /** Height of the top project tab bar in CSS px (Settings → Appearance). Hand-editable; every+ * reader — the renderer's `--tabbar-h` and main's traffic-light `y` — goes through+ * `resolveTabBarHeight` (`@shared/window-chrome-metrics`), which clamps to 28–64 and answers+ * the default for anything that is not a finite number. Machine-local: it is one person's+ * chrome, not a canvas fact. */+ tabBarHeight: number/** Default size (px) for NEW terminal/agent nodes on the canvas. Existing nodes keep* whatever size they were saved with; other node kinds keep their own defaults. */defaultNodeWidth: number@@ -1809,6 +1816,7 @@ export const DEFAULT_SETTINGS: Settings = {gridSize: 24,snapToGrid: false,autoAlignGrid: false,+ tabBarHeight: TABBAR_HEIGHT_PX,defaultNodeWidth: 640,defaultNodeHeight: 440,sidebarAutoCollapse: true,diff --git a/src/shared/window-chrome-metrics.ts b/src/shared/window-chrome-metrics.tsindex 8112c3468..2d55cd749 100644--- a/src/shared/window-chrome-metrics.ts+++ b/src/shared/window-chrome-metrics.ts@@ -10,10 +10,29 @@* stylesheet's token to it.*/-/** Height of `.tabbar`, in CSS px. Chrome's own strip is ~40, and so is this: 36 was a touch- * tighter than the reference and read as cramped once the tabs carried full names. */+/** DEFAULT height of `.tabbar`, in CSS px. Chrome's own strip is ~40, and so is this: 36 was a+ * touch tighter than the reference and read as cramped once the tabs carried full names. The+ * user may change it (`settings.tabBarHeight`, Settings → Appearance); every reader goes through+ * `resolveTabBarHeight`, and this constant is what the stylesheet's `--tabbar-h` token carries so+ * a renderer that has not applied the setting yet draws the default. */export const TABBAR_HEIGHT_PX = 40+/** Clamp bounds for the hand-editable setting. 28 leaves the 12px traffic lights an 8px margin;+ * above 64 the bar stops reading as a tab strip and starts eating the canvas. */+export const TABBAR_HEIGHT_MIN_PX = 28+export const TABBAR_HEIGHT_MAX_PX = 64++/**+ * Resolve a hand-editable settings value to a bar height. Anything non-numeric — absent (every+ * pre-feature settings.json), NaN, Infinity, a string — is the default; numbers are rounded to a+ * whole pixel (a fractional bar height blurs every 1px divider under it) and clamped, so a wild+ * value can never hide the bar or push the traffic lights off it.+ */+export function resolveTabBarHeight(value: unknown): number {+ if (typeof value !== 'number' || !Number.isFinite(value)) return TABBAR_HEIGHT_PX+ return Math.min(TABBAR_HEIGHT_MAX_PX, Math.max(TABBAR_HEIGHT_MIN_PX, Math.round(value)))+}+/** The macOS traffic lights are 12px discs (measured on a 2x capture: 24 device px). */export const TRAFFIC_LIGHT_DIAMETER_PX = 12