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.

feat(settings): configurable default size for new terminal/agent nodes

enesd4ca6352498c
diff --git a/src/renderer/components/settings/sections/BehaviorSection.tsx b/src/renderer/components/settings/sections/BehaviorSection.tsx
index ad6a8d6e6..38b129f85 100644
--- a/src/renderer/components/settings/sections/BehaviorSection.tsx
+++ b/src/renderer/components/settings/sections/BehaviorSection.tsx
@@ -7,6 +7,10 @@ import { NumberField } from '@renderer/ui/NumberField'
const ROWS = {
gridSize: { title: 'Grid size', keywords: ['grid', 'size', 'snap'] },
+ nodeSize: {
+ title: 'Default node size',
+ keywords: ['node', 'size', 'width', 'height', 'terminal', 'default']
+ },
snap: { title: 'Snap to grid', keywords: ['snap', 'grid', 'align'] },
panHover: { title: 'Pan-hover delay (ms)', keywords: ['pan', 'hover', 'delay', 'focus', 'guard'] },
doubleClick: { title: 'Double-click to focus', keywords: ['double', 'click', 'focus'] },
@@ -32,6 +36,31 @@ export function BehaviorSection({ isActive }: { isActive: boolean }): React.JSX.
}
/>
</SearchableRow>
+ <SearchableRow {...ROWS.nodeSize}>
+ <FieldRow
+ label="Default node size (px)"
+ description="Size new terminal and agent nodes open at. Existing nodes keep their size."
+ control={
+ <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
+ <NumberField
+ value={settings.defaultNodeWidth}
+ min={280}
+ max={2400}
+ step={20}
+ onChange={(v) => update({ defaultNodeWidth: v || 600 })}
+ />
+ <span style={{ opacity: 0.6 }}>×</span>
+ <NumberField
+ value={settings.defaultNodeHeight}
+ min={160}
+ max={1600}
+ step={20}
+ onChange={(v) => update({ defaultNodeHeight: v || 400 })}
+ />
+ </div>
+ }
+ />
+ </SearchableRow>
<SearchableRow {...ROWS.snap}>
<FieldRow
label="Snap to grid"
diff --git a/src/renderer/state/workspace.ts b/src/renderer/state/workspace.ts
index e2bc66407..e6b4be633 100644
--- a/src/renderer/state/workspace.ts
+++ b/src/renderer/state/workspace.ts
@@ -143,6 +143,23 @@ function placeAt(center: { x: number; y: number } | undefined, index: number, w:
return center ? { x: center.x - w / 2, y: center.y - h / 2 } : staggeredPosition(index)
}
+/**
+ * Default size for NEW terminal/agent nodes: the user's setting (Settings → Canvas), clamped
+ * to sane canvas bounds — settings.json is hand-editable, and a 0×0 or NaN node would be
+ * unclickable/ungrabbable forever. Falls back to the historical 600×400.
+ */
+function terminalNodeSize(): { width: number; height: number } {
+ const s = useSettings.getState().settings
+ const clamp = (v: unknown, lo: number, hi: number, dflt: number): number => {
+ const n = typeof v === 'number' && Number.isFinite(v) ? Math.round(v) : dflt
+ return Math.min(hi, Math.max(lo, n))
+ }
+ return {
+ width: clamp(s.defaultNodeWidth, 280, 2400, TERMINAL_SIZE.width),
+ height: clamp(s.defaultNodeHeight, 160, 1600, TERMINAL_SIZE.height)
+ }
+}
+
/**
* Creates a new terminal node. `cwd` comes from the active project's default folder. When `ssh`
* (the active SSH project's binding) is given, the node runs in REMOTE tmux on that host: its
@@ -155,13 +172,14 @@ export function createTerminalNode(
initialCommand?: string,
ssh?: Project['ssh']
): CanvasNode {
+ const size = terminalNodeSize()
return {
id: nextId('term'),
type: 'terminal',
- position: placeAt(center, index, TERMINAL_SIZE.width, TERMINAL_SIZE.height),
- width: TERMINAL_SIZE.width,
- height: TERMINAL_SIZE.height,
- style: { width: TERMINAL_SIZE.width, height: TERMINAL_SIZE.height },
+ position: placeAt(center, index, size.width, size.height),
+ width: size.width,
+ height: size.height,
+ style: { width: size.width, height: size.height },
data: {
title: `Terminal ${index + 1}`,
color: NODE_COLORS[index % NODE_COLORS.length],
@@ -183,13 +201,14 @@ export function createSshTerminalNode(
index: number,
center?: { x: number; y: number }
): CanvasNode {
+ const size = terminalNodeSize()
return {
id: nextId('ssh'),
type: 'terminal',
- position: placeAt(center, index, TERMINAL_SIZE.width, TERMINAL_SIZE.height),
- width: TERMINAL_SIZE.width,
- height: TERMINAL_SIZE.height,
- style: { width: TERMINAL_SIZE.width, height: TERMINAL_SIZE.height },
+ position: placeAt(center, index, size.width, size.height),
+ width: size.width,
+ height: size.height,
+ style: { width: size.width, height: size.height },
data: {
title: server.label,
color: NODE_COLORS[index % NODE_COLORS.length],
@@ -313,13 +332,14 @@ export function createAgentNode(
const initialCommand = permissionMode
? withPermissionMode(withPrompt, agentId, permissionMode)
: withPrompt
+ const size = terminalNodeSize()
return {
id: nextId('term'),
type: 'terminal',
- position: placeAt(center, index, TERMINAL_SIZE.width, TERMINAL_SIZE.height),
- width: TERMINAL_SIZE.width,
- height: TERMINAL_SIZE.height,
- style: { width: TERMINAL_SIZE.width, height: TERMINAL_SIZE.height },
+ position: placeAt(center, index, size.width, size.height),
+ width: size.width,
+ height: size.height,
+ style: { width: size.width, height: size.height },
data: {
title: label,
// Adopt the agent's own session name into the title until the user renames it by hand.
diff --git a/src/shared/types.ts b/src/shared/types.ts
index fe3b5115d..40c25f9f9 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -449,6 +449,10 @@ export interface Settings {
defaultShell: string
gridSize: number
snapToGrid: boolean
+ /** 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
+ defaultNodeHeight: number
/** ms to dwell over a terminal before it takes pointer focus (pan-across guard). */
panHoverDelay: number
doubleClickFocus: boolean
@@ -504,6 +508,8 @@ export const DEFAULT_SETTINGS: Settings = {
defaultShell: '',
gridSize: 24,
snapToGrid: false,
+ defaultNodeWidth: 600,
+ defaultNodeHeight: 400,
panHoverDelay: 600,
doubleClickFocus: true,
wheelZoom: false,