Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(ui): one restore control with upward dropdown; explicit note editing; theme+fullscreen in the title bar; whole-app dark mode

Chaitanya Giri5510818aac5b
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 6dd9a605..303de391 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -14,6 +14,7 @@ import { HivePicker } from '@/components/HivePicker';
import { QuitWarningModal, type ClosingTimeState } from '@/components/QuitWarningModal';
import { CompletionToast } from '@/realtime/CompletionToast';
import { UpdateToast } from '@/components/UpdateToast';
+import { useAppTheme, toggleAppTheme } from '@/design/theme';
import { SettingsModal } from '@/components/SettingsModal';
import { PixelPanel } from '@/components/PixelPanel';
import { PixelButton } from '@/components/PixelButton';
@@ -38,6 +39,7 @@ export function App() {
const setAddAgentOpen = useStore(s => s.setAddAgentOpen);
const godStatus = useStore(s => s.godStatus);
const fullscreenAgentId = useStore(s => s.fullscreenAgentId);
+ const appThemeNow = useAppTheme();
const fullscreenFilePath = useStore(s => s.fullscreenFilePath);
const sidebarWidth = useStore(s => s.sidebarWidth);
const setSidebarWidth = useStore(s => s.setSidebarWidth);
@@ -243,13 +245,62 @@ export function App() {
}}>
v{__APP_VERSION__} · {config.autoMode ? 'auto mode on' : 'auto mode off'}
</span>
+ {/* v0.3.4: theme + fullscreen live HERE (top right), not buried in the
+ terminal header — and the theme darkens the whole app, terminals
+ included (design/theme.ts + tokens.css dark block). */}
+ <button
+ className="cth-titlebar-nodrag"
+ onClick={() => {
+ const next = toggleAppTheme();
+ // Mirror into the harness config: every agent (re)spawned from now
+ // on gets the matching `theme` in its per-session Claude settings,
+ // so the TUI's truecolor palette fits the terminal. Scoped to
+ // harness agents — the user's global Claude theme is never touched.
+ void window.cth.updateConfig({ terminalTheme: next });
+ }}
+ title={appThemeNow === 'dark' ? 'Switch to the light theme' : 'Switch to the dark theme'}
+ aria-label="Toggle dark mode"
+ style={{
+ marginLeft: 'auto',
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ width: 28, height: 28, padding: 0,
+ background: 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1.5px var(--cth-ink-900)',
+ border: 'none', borderRadius: 2, cursor: 'pointer',
+ color: 'var(--cth-ink-900)', fontSize: 14, lineHeight: 1
+ }}
+ >
+ {appThemeNow === 'dark' ? '☀' : '☾'}
+ </button>
+ <button
+ className="cth-titlebar-nodrag"
+ onClick={() => {
+ if (fullscreenAgentId) { useStore.getState().setFullscreen(null); return; }
+ const all = useStore.getState().agents;
+ const target = all.find((x) => x.id === useStore.getState().selectedId && x.ptyId)
+ ?? all.find((x) => x.isGod && x.ptyId)
+ ?? all.find((x) => x.ptyId);
+ if (target) useStore.getState().setFullscreen(target.id);
+ }}
+ title={fullscreenAgentId ? 'Exit fullscreen (Esc)' : 'Fullscreen terminal — selected agent'}
+ aria-label="Toggle fullscreen terminal"
+ style={{
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ width: 28, height: 28, padding: 0,
+ background: 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1.5px var(--cth-ink-900)',
+ border: 'none', borderRadius: 2, cursor: 'pointer',
+ color: 'var(--cth-ink-900)'
+ }}
+ >
+ <Icon name={fullscreenAgentId ? 'minimize' : 'expand'} size={1} style={{ width: 16, height: 16 }} />
+ </button>
<button
className="cth-titlebar-nodrag"
onClick={() => setIdeOpen(true)}
title="Open IDE — file editor + git diff"
aria-label="Open IDE"
style={{
- marginLeft: 'auto',
display: 'inline-flex', alignItems: 'center', gap: 5,
height: 28, padding: '0 9px',
background: 'var(--cth-paper-100)',
diff --git a/src/renderer/src/components/AgentStrip.tsx b/src/renderer/src/components/AgentStrip.tsx
index 455a49da..e9d0642d 100644
--- a/src/renderer/src/components/AgentStrip.tsx
+++ b/src/renderer/src/components/AgentStrip.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { AgentCard } from './AgentCard';
import { PixelButton } from './PixelButton';
import { Icon } from './Icon';
@@ -22,12 +22,34 @@ export function AgentStrip({ config }: AgentStripProps) {
const reorderAgents = useStore(s => s.reorderAgents);
const setAgentNote = useStore(s => s.setAgentNote);
// Shared with the fullscreen roster so both show one restore in progress.
- const { restoring, autoRestoring, restoreNote, restoreTeam } = useRestoreTeam(config);
+ const { restoring, autoRestoring, restoreTeam } = useRestoreTeam(config);
+ // ONE restore control (bottom-right): a button whose dropdown OPENS UPWARD and
+ // lists last session's agents with per-agent dismiss. The menu is position:
+ // fixed (anchored off the button's rect) because the strip scrolls with
+ // overflow hidden — an absolute child would be clipped.
+ const [restoreMenuOpen, setRestoreMenuOpen] = useState(false);
+ const [restoreMenuPos, setRestoreMenuPos] = useState<{ right: number; bottom: number } | null>(null);
+ const restoreBtnRef = useRef<HTMLSpanElement>(null);
+ const restoreBusy = restoring || autoRestoring;
+ useEffect(() => {
+ if (restorableAgents.length === 0 || restoreBusy) setRestoreMenuOpen(false);
+ }, [restorableAgents.length, restoreBusy]);
+ const toggleRestoreMenu = (anchor: HTMLElement | null) => {
+ if (restoreMenuOpen) { setRestoreMenuOpen(false); return; }
+ const rect = anchor?.getBoundingClientRect();
+ if (!rect) return;
+ setRestoreMenuPos({
+ right: Math.max(8, window.innerWidth - rect.right),
+ bottom: Math.max(8, window.innerHeight - rect.top + 6)
+ });
+ setRestoreMenuOpen(true);
+ };
// Drag-to-reorder the roster: dragId = the card being dragged, overId = the card
// currently hovered as a drop target (drives the insertion-line cue).
const [dragId, setDragId] = useState<string | null>(null);
const [overId, setOverId] = useState<string | null>(null);
- const [noteHoverId, setNoteHoverId] = useState<string | null>(null);
+ // Note editing is EXPLICIT (✎ toggles the editor) — nothing appears on hover.
+ const [noteEditId, setNoteEditId] = useState<string | null>(null);
// Each worker's actively-DOING ledger tasks, polled from hive/tasks.json —
// rendered as a sticky note on the avatar card (click → task detail).
const [doingByAgent, setDoingByAgent] = useState<Record<string, string[]>>({});
@@ -88,8 +110,6 @@ export function AgentStrip({ config }: AgentStripProps) {
setOverId(null);
}}
onDragEnd={() => { setDragId(null); setOverId(null); }}
- onMouseEnter={() => setNoteHoverId(a.id)}
- onMouseLeave={() => setNoteHoverId((id) => id === a.id ? null : id)}
style={{
position: 'relative',
flexShrink: 0,
@@ -123,7 +143,10 @@ export function AgentStrip({ config }: AgentStripProps) {
if (first) openTaskDetail(first);
}}
/>
- {noteHoverId === a.id && !dragId && (
+ {/* Private note — VISIBLE by default when one exists (this used to be
+ fullscreen-only + hover-gated). Editing is explicit: the ✎ button
+ opens the editor in place; Esc / ✎ again closes it. */}
+ {noteEditId === a.id && !dragId ? (
<div
onClick={(e) => e.stopPropagation()}
onMouseDown={(e) => e.stopPropagation()}
@@ -144,11 +167,13 @@ export function AgentStrip({ config }: AgentStripProps) {
silently drops the newlines the moment the user edits here,
which would eat every bullet but the first. */}
<textarea
+ autoFocus
draggable={false}
rows={1}
wrap="off"
value={a.note ?? ''}
onChange={(e) => setAgentNote(a.id, e.target.value)}
+ onKeyDown={(e) => { if (e.key === 'Escape') setNoteEditId(null); }}
placeholder="private note…"
aria-label={`Note for ${a.name}`}
title={a.note || undefined}
@@ -161,93 +186,64 @@ export function AgentStrip({ config }: AgentStripProps) {
lineHeight: '18px', color: 'var(--cth-ink-900)'
}}
/>
+ <button
+ onClick={() => setNoteEditId(null)}
+ title="Done"
+ aria-label="Close note editor"
+ style={{
+ flexShrink: 0, width: 18, height: 18, padding: 0, lineHeight: 1,
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ fontFamily: 'var(--cth-font-ui)', fontSize: 11,
+ color: 'var(--cth-ink-500)', background: 'transparent',
+ border: 'none', cursor: 'pointer'
+ }}
+ >✕</button>
</div>
- )}
- </div>
- ))}
- {autoRestoring && (
- // The team comes back on its own at boot, so SAY so — terminals opening
- // by themselves with no explanation reads as the app doing something
- // you didn't ask for.
- <span
- style={{
- alignSelf: 'center', flexShrink: 0,
- display: 'inline-flex', alignItems: 'center', gap: 6,
- height: 32, padding: '0 10px',
- fontFamily: 'var(--cth-font-ui)', fontSize: 12,
- color: 'var(--cth-ink-900)',
- background: 'var(--cth-status-working)',
- boxShadow: 'inset 0 0 0 1px var(--cth-ink-900)'
- }}
- title="Your previous session's agents are being respawned with their original ids, so memory and inboxes reattach."
- >
- <Icon name="play" /> restoring your team…
- </span>
- )}
- {restorableAgents.length > 0 && (
- <span
- style={{ alignSelf: 'center', flexShrink: 0 }}
- title={`Respawn from last session: ${restorableAgents.map((a: Agent) => a.name).join(', ')} — same ids, memory and inboxes reattach automatically`}
- >
- <PixelButton
- variant="primary"
- size="lg"
- onClick={restoreTeam}
- disabled={restoring}
- >
- <span style={{ display: 'inline-flex', gap: 6, alignItems: 'center', whiteSpace: 'nowrap' }}>
- <Icon name="play" /> {restoring ? 'restoring…' : `restore team (${restorableAgents.length})`}
- </span>
- </PixelButton>
- </span>
- )}
- {/* Per-agent dismiss: drop one worker from the restore list for good. Wires
- straight to the store's removeRestorableAgent (filters + persistRestorable
- → cth.restorableAgents), so a dismissed agent never reappears after reload. */}
- {restorableAgents.length > 0 && (
- <span style={{ display: 'inline-flex', gap: 6, alignItems: 'center', flexShrink: 0 }}>
- {restorableAgents.map((a: Agent) => (
- <span
- key={a.id}
- title={`${a.name} — restorable from last session`}
+ ) : !dragId && (
+ <div
+ onClick={(e) => e.stopPropagation()}
+ onMouseDown={(e) => e.stopPropagation()}
style={{
- display: 'inline-flex', alignItems: 'center', gap: 4,
- flexShrink: 0, height: 24, padding: '0 4px 0 8px',
- fontFamily: 'var(--cth-font-ui)', fontSize: 12,
- color: 'var(--cth-ink-700)', background: 'var(--cth-paper-100)',
- boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'
+ position: 'absolute', left: 60, right: 7, bottom: 7, height: a.note ? 22 : 0, zIndex: 5,
+ display: 'flex', alignItems: 'center', gap: 4,
+ pointerEvents: 'none'
}}
>
- {a.name}
+ {a.note && (
+ <span
+ title={a.note}
+ style={{
+ flex: 1, minWidth: 0, padding: '1px 5px',
+ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis',
+ background: 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',
+ fontFamily: 'var(--cth-font-mono)', fontSize: 11,
+ lineHeight: '18px', color: 'var(--cth-ink-700)'
+ }}
+ >
+ {a.note.split('\n')[0]}
+ {a.note.includes('\n') ? ` (+${a.note.split('\n').filter(Boolean).length - 1})` : ''}
+ </span>
+ )}
<button
- onClick={() => useStore.getState().removeRestorableAgent(a.id)}
- title={`Dismiss ${a.name} — remove permanently from the restore list`}
- aria-label={`Dismiss ${a.name}`}
+ onClick={(e) => { e.stopPropagation(); setNoteEditId(a.id); }}
+ title={a.note ? 'Edit private note' : 'Add private note'}
+ aria-label={`Edit note for ${a.name}`}
style={{
+ pointerEvents: 'auto',
+ position: a.note ? 'static' : 'absolute', right: 0, bottom: 0,
+ flexShrink: 0, width: 20, height: 20, padding: 0, lineHeight: 1,
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
- width: 16, height: 16, padding: 0, lineHeight: 1,
- fontFamily: 'var(--cth-font-ui)', fontSize: 12,
- color: 'var(--cth-ink-500)', background: 'transparent',
+ fontSize: 11, color: 'var(--cth-ink-500)',
+ background: 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',
border: 'none', cursor: 'pointer'
}}
- >✕</button>
- </span>
- ))}
- </span>
- )}
- {restoreNote && (
- <span
- style={{
- alignSelf: 'center', flexShrink: 0, maxWidth: 360,
- fontFamily: 'var(--cth-font-ui)', fontSize: 12,
- color: 'var(--cth-ink-500)',
- whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'
- }}
- title={restoreNote}
- >
- {restoreNote}
- </span>
- )}
+ >✎</button>
+ </div>
+ )}
+ </div>
+ ))}
<PixelButton
variant="secondary"
size="lg"
@@ -258,6 +254,99 @@ export function AgentStrip({ config }: AgentStripProps) {
<Icon name="plus" /> add agent
</span>
</PixelButton>
+ {/* ONE restore control, pinned to the strip's right edge. Busy (manual OR
+ boot auto-restore) collapses to a single disabled "restoring your
+ team…"; otherwise the button opens an upward dropdown listing last
+ session's agents (per-agent ✕ dismiss + restore all). No outcome note
+ is rendered afterwards — the restored agents appearing IS the outcome. */}
+ {(restorableAgents.length > 0 || restoreBusy) && (
+ <span
+ ref={restoreBtnRef}
+ style={{ alignSelf: 'center', flexShrink: 0, marginLeft: 'auto' }}
+ title={restoreBusy
+ ? "Your previous session's agents are being respawned with their original ids, so memory and inboxes reattach."
+ : `Previous session: ${restorableAgents.map((a: Agent) => a.name).join(', ')}`}
+ >
+ <PixelButton
+ variant="primary"
+ size="lg"
+ disabled={restoreBusy}
+ onClick={() => toggleRestoreMenu(restoreBtnRef.current)}
+ >
+ <span style={{ display: 'inline-flex', gap: 6, alignItems: 'center', whiteSpace: 'nowrap' }}>
+ <Icon name="play" />
+ {restoreBusy ? 'restoring your team…' : `restore team (${restorableAgents.length}) ▴`}
+ </span>
+ </PixelButton>
+ </span>
+ )}
+ {restoreMenuOpen && restoreMenuPos && restorableAgents.length > 0 && (
+ <>
+ {/* click-away backdrop */}
+ <div
+ onClick={() => setRestoreMenuOpen(false)}
+ style={{ position: 'fixed', inset: 0, zIndex: 349, background: 'transparent' }}
+ />
+ <div style={{
+ position: 'fixed', right: restoreMenuPos.right, bottom: restoreMenuPos.bottom,
+ zIndex: 350, minWidth: 240, maxHeight: '50vh', overflowY: 'auto',
+ background: 'var(--cth-cream-50)',
+ boxShadow: '0 0 0 2px var(--cth-ink-900), 3px 4px 0 0 rgba(26,19,32,0.22)',
+ padding: 8, display: 'flex', flexDirection: 'column', gap: 6,
+ fontFamily: 'var(--cth-font-ui)'
+ }}>
+ <span style={{
+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',
+ color: 'var(--cth-ink-500)', textTransform: 'uppercase'
+ }}>
+ previous session
+ </span>
+ {/* Per-agent dismiss wires straight to removeRestorableAgent
+ (filters + persistRestorable), so a dismissed agent never
+ reappears after reload. */}
+ {restorableAgents.map((a: Agent) => (
+ <span
+ key={a.id}
+ title={`${a.name} — restorable from last session`}
+ style={{
+ display: 'flex', alignItems: 'center', gap: 6,
+ height: 26, padding: '0 4px 0 8px',
+ fontSize: 13, color: 'var(--cth-ink-900)',
+ background: 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'
+ }}
+ >
+ <span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
+ {a.name}
+ </span>
+ <span style={{ fontSize: 11, color: 'var(--cth-ink-500)', whiteSpace: 'nowrap' }}>
+ {a.description ? a.description.slice(0, 24) : ''}
+ </span>
+ <button
+ onClick={() => useStore.getState().removeRestorableAgent(a.id)}
+ title={`Dismiss ${a.name} — remove permanently from the restore list`}
+ aria-label={`Dismiss ${a.name}`}
+ style={{
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ width: 18, height: 18, padding: 0, lineHeight: 1,
+ fontSize: 12, color: 'var(--cth-ink-500)',
+ background: 'transparent', border: 'none', cursor: 'pointer'
+ }}
+ >✕</button>
+ </span>
+ ))}
+ <PixelButton
+ variant="primary"
+ size="sm"
+ onClick={() => { setRestoreMenuOpen(false); void restoreTeam(); }}
+ >
+ <span style={{ display: 'inline-flex', gap: 6, alignItems: 'center', whiteSpace: 'nowrap' }}>
+ <Icon name="play" /> restore all ({restorableAgents.length})
+ </span>
+ </PixelButton>
+ </div>
+ </>
+ )}
</div>
);
}
diff --git a/src/renderer/src/components/FullscreenTerminal.tsx b/src/renderer/src/components/FullscreenTerminal.tsx
index 943ea108..0e483c22 100644
--- a/src/renderer/src/components/FullscreenTerminal.tsx
+++ b/src/renderer/src/components/FullscreenTerminal.tsx
@@ -481,7 +481,6 @@ function SidebarRow({
}) {
const buttonRef = useRef<HTMLButtonElement>(null);
const noteRef = useRef<HTMLDivElement>(null);
- const hideTimer = useRef<number | null>(null);
const [notePosition, setNotePosition] = useState<{ left: number; top: number } | null>(null);
// The editor rides the terminal's zoom, capped — it's a short note, not a
@@ -500,16 +499,13 @@ function SidebarRow({
const typing = useHasTerminalDraft(agent.ptyId);
- useEffect(() => () => {
- if (hideTimer.current !== null) window.clearTimeout(hideTimer.current);
- }, []);
-
- /** Hovering a row opens its editor beside it — the bullets on the row are the
- * summary, this is where you write them. */
- const openEditor = () => {
- // An editor popping up under the cursor mid-drag just gets in the way.
+ /** The ✎ button opens the editor beside the row — the bullets on the row are
+ * the summary, this is where you write them. EXPLICIT open only (v0.3.4):
+ * hovering the roster no longer pops editors under the pointer. */
+ const toggleEditor = () => {
+ if (notePosition) { setNotePosition(null); return; }
+ // An editor popping up mid-drag just gets in the way.
if (drag.dragId) return;
- if (hideTimer.current !== null) window.clearTimeout(hideTimer.current);
const rect = buttonRef.current?.getBoundingClientRect();
if (!rect) return;
// The roster is a left rail, so the editor opens to the RIGHT of its row.
@@ -520,16 +516,6 @@ function SidebarRow({
});
};
- /** Close on a delay so the pointer can travel from the row into the editor
- * without it vanishing en route, and stay open while it's being typed in. */
- const scheduleClose = () => {
- if (hideTimer.current !== null) window.clearTimeout(hideTimer.current);
- hideTimer.current = window.setTimeout(() => {
- if (noteRef.current?.contains(document.activeElement)) return;
- setNotePosition(null);
- }, 160);
- };
-
return (
<>
<button
@@ -546,8 +532,6 @@ function SidebarRow({
onDrop={(e) => { e.preventDefault(); drag.drop(agent.id); }}
onDragEnd={drag.end}
onClick={onClick}
- onMouseEnter={openEditor}
- onMouseLeave={scheduleClose}
aria-label={`${agent.name} · ${agent.project}`}
aria-current={active ? 'true' : undefined}
style={{
@@ -594,6 +578,26 @@ function SidebarRow({
agent with a draft on its prompt is not idle-and-free, it is
idle-and-held, and nothing else on screen said so. */}
<PixelBadge status={typing ? 'typing' : agent.status} />
+ {/* Explicit note edit — a real control instead of a hover surprise.
+ A span, not a <button>: we're inside the row's button element. */}
+ <span
+ role="button"
+ tabIndex={0}
+ onClick={(e) => { e.stopPropagation(); toggleEditor(); }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); e.preventDefault(); toggleEditor(); }
+ }}
+ title={agent.note ? 'Edit private note' : 'Add private note'}
+ aria-label={`Edit note for ${agent.name}`}
+ style={{
+ flexShrink: 0, width: 20, height: 20,
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
+ fontSize: 12, lineHeight: 1, color: 'var(--cth-ink-500)',
+ background: notePosition ? 'var(--cth-cream-200)' : 'var(--cth-paper-100)',
+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',
+ cursor: 'pointer'
+ }}
+ >✎</span>
</div>
{/* Every line of every agent, always on screen — the roster's job is
to answer "who is on what" without a single interaction. */}
@@ -627,10 +631,14 @@ function SidebarRow({
</div>
</button>
{notePosition && createPortal(
+ <>
+ {/* click-away backdrop — the editor stays until dismissed on purpose */}
+ <div
+ onClick={() => setNotePosition(null)}
+ style={{ position: 'fixed', inset: 0, zIndex: 449, background: 'transparent' }}
+ />
<div
ref={noteRef}
- onMouseEnter={openEditor}
- onMouseLeave={scheduleClose}
onClick={(e) => e.stopPropagation()}
style={{
position: 'fixed',
@@ -652,17 +660,12 @@ function SidebarRow({
color: 'var(--cth-ink-700)'
}}>PRIVATE NOTE</div>
{/* A textarea, not an input: the note is a bullet list, so Enter has
- to make a new line rather than doing nothing. */}
- {/* No autoFocus — the editor opens on hover, and stealing focus every
- time the pointer crosses the roster would pull the caret out of
- whatever the user was typing. Click into it to edit. */}
+ to make a new line rather than doing nothing. autoFocus is safe
+ now that opening is an explicit click, not a pointer fly-by. */}
<textarea
+ autoFocus
value={agent.note ?? ''}
onChange={(e) => onNoteChange(e.target.value)}
- onFocus={() => {
- if (hideTimer.current !== null) window.clearTimeout(hideTimer.current);
- }}
- onBlur={scheduleClose}
onKeyDown={(e) => {
e.stopPropagation(); // don't let Esc/typing reach the fullscreen handler
if (e.key === 'Escape') {
@@ -691,7 +694,8 @@ function SidebarRow({
<div style={{
marginTop: 5, fontSize: 10, color: 'var(--cth-ink-500)'
}}>one line = one bullet · esc to close</div>
- </div>,
+ </div>
+ </>,
document.body
)}
</>
diff --git a/src/renderer/src/components/PtyTerminalView.tsx b/src/renderer/src/components/PtyTerminalView.tsx
index 84fd064e..2995ff87 100644
--- a/src/renderer/src/components/PtyTerminalView.tsx
+++ b/src/renderer/src/components/PtyTerminalView.tsx
@@ -11,6 +11,7 @@ import {
setTerminalFontSize,
useTerminalFontSize
} from './terminalFontSize';
+import { useAppTheme } from '@/design/theme';
// Zoom lives in ./terminalFontSize so anything outside the terminal (the message
// composer) can scale with it too; these aliases keep the call sites below short.
@@ -18,21 +19,11 @@ const DEFAULT_FONT_SIZE = DEFAULT_TERMINAL_FONT_SIZE;
const MIN_FONT_SIZE = MIN_TERMINAL_FONT_SIZE;
const MAX_FONT_SIZE = MAX_TERMINAL_FONT_SIZE;
-const LS_THEME = 'cth.ptyTheme';
-
+// v0.3.4: the terminal follows the APP-WIDE theme (design/theme.ts, toggled in
+// the title bar) instead of keeping its own light/dark switch — one theme for
+// chrome, terminal, and (via config.terminalTheme) each agent's TUI palette.
type PtyTheme = 'light' | 'dark';
-function loadTheme(): PtyTheme {
- try {
- const v = window.localStorage.getItem(LS_THEME);
- if (v === 'dark' || v === 'light') return v;
- } catch { /* noop */ }
- // Cream by default — safe because each agent's per-session Claude settings
- // mirror the terminal theme, so the TUI paints the matching truecolor
- // palette (light on cream, dark on ink).
- return 'light';
-}
-
const zoomBtnStyle: CSSProperties = {
width: 18,
height: 18,
@@ -134,7 +125,7 @@ export function PtyTerminalView({ ptyId, onStreamData, onUserPrompt, onToggleFul
onUserPromptRef.current = onUserPrompt;
const fontSize = useTerminalFontSize();
const fontSizeRef = useRef(fontSize);
- const [ptyTheme, setPtyTheme] = useState<PtyTheme>(loadTheme);
+ const ptyTheme: PtyTheme = useAppTheme();
const ptyThemeRef = useRef(ptyTheme);
ptyThemeRef.current = ptyTheme;
@@ -273,9 +264,9 @@ export function PtyTerminalView({ ptyId, onStreamData, onUserPrompt, onToggleFul
};
}, [ptyId]);
- // Apply theme changes to the pooled terminal and persist the choice.
+ // Apply app-theme changes to the pooled terminal (persistence lives in
+ // design/theme.ts — the title-bar toggle owns it).
useEffect(() => {
- try { window.localStorage.setItem(LS_THEME, ptyTheme); } catch { /* noop */ }
acquireTerminal(ptyId, THEMES[ptyTheme], fontSizeRef.current).term.options.theme = THEMES[ptyTheme];
}, [ptyTheme, ptyId]);
@@ -381,23 +372,9 @@ export function PtyTerminalView({ ptyId, onStreamData, onUserPrompt, onToggleFul
}} />
live · pty {ptyId}
<div style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center', gap: 2 }}>
- <button
- onClick={() => {
- const next: PtyTheme = ptyTheme === 'dark' ? 'light' : 'dark';
- setPtyTheme(next);
- // Mirror into the harness config: every agent (re)spawned from
- // now on gets the matching `theme` in its per-session Claude
- // settings, so the TUI's truecolor palette fits the terminal.
- // Scoped to harness agents — the user's global Claude theme
- // (their own terminals) is never touched. Running sessions keep
- // their palette until they restart.
- void window.cth.updateConfig({ terminalTheme: next });
- }}
- title={ptyTheme === 'dark'
- ? 'Switch terminal + agent sessions to the light theme'
- : 'Switch terminal + agent sessions to the dark theme'}
- style={{ ...zoomBtnStyle, width: 22, marginRight: 4 }}
- >{ptyTheme === 'dark' ? '☀' : '☾'}</button>
+ {/* v0.3.4: the theme + enter-fullscreen buttons moved to the TITLE BAR
+ (top right) — more accessible, and the theme now darkens the whole
+ app. Only the EXIT affordance stays here, in fullscreen. */}
<button
onClick={() => zoom(-1)}
disabled={fontSize <= MIN_FONT_SIZE}
@@ -415,13 +392,13 @@ export function PtyTerminalView({ ptyId, onStreamData, onUserPrompt, onToggleFul
title="Zoom in (Cmd +)"
style={zoomBtnStyle}
>+</button>
- {onToggleFullscreen && (
+ {fullscreen && onToggleFullscreen && (
<button
onClick={onToggleFullscreen}
- title={fullscreen ? 'Exit fullscreen (Esc)' : 'Fullscreen terminal'}
+ title="Exit fullscreen (Esc)"
style={{ ...zoomBtnStyle, width: 22, height: 22, marginLeft: 4 }}
>
- <Icon name={fullscreen ? 'minimize' : 'expand'} />
+ <Icon name="minimize" />
</button>
)}
</div>
diff --git a/src/renderer/src/design/theme.ts b/src/renderer/src/design/theme.ts
new file mode 100644
index 00000000..1423e2c4
--- /dev/null
+++ b/src/renderer/src/design/theme.ts
@@ -0,0 +1,64 @@
+/**
+ * App-wide theme (v0.3.4) — ONE light/dark switch for the whole UI, not just
+ * the terminal.
+ *
+ * The entire renderer is styled through the `--cth-*` tokens, so dark mode is
+ * a token swap: this module stamps `data-cth-theme` on <html> and tokens.css
+ * carries the dark overrides. The xterm palette (PtyTerminalView) and the
+ * per-agent Claude session theme (config.terminalTheme, applied on spawn)
+ * follow the same state, so terminals and TUIs match the chrome.
+ *
+ * Shared subscribable module (same pattern as terminalFontSize): components
+ * read it with `useAppTheme()`; the ONE toggle lives in the title bar.
+ */
+import { useSyncExternalStore } from 'react';
+
+export type AppTheme = 'light' | 'dark';
+
+const LS_KEY = 'cth.theme';
+/** Pre-0.3.4 the terminal had its own theme key — honor it once as the seed. */
+const LEGACY_LS_KEY = 'cth.ptyTheme';
+
+function load(): AppTheme {
+ try {
+ const v = window.localStorage.getItem(LS_KEY) ?? window.localStorage.getItem(LEGACY_LS_KEY);
+ if (v === 'dark' || v === 'light') return v;
+ } catch { /* noop */ }
+ return 'light';
+}
+
+let theme: AppTheme = load();
+const subscribers = new Set<() => void>();
+
+function apply(): void {
+ try { document.documentElement.dataset.cthTheme = theme; } catch { /* SSR/tests */ }
+}
+apply();
+
+export function appTheme(): AppTheme {
+ return theme;
+}
+
+export function setAppTheme(next: AppTheme): void {
+ if (next === theme) return;
+ theme = next;
+ try { window.localStorage.setItem(LS_KEY, next); } catch { /* noop */ }
+ apply();
+ subscribers.forEach((fn) => fn());
+}
+
+export function toggleAppTheme(): AppTheme {
+ const next: AppTheme = theme === 'dark' ? 'light' : 'dark';
+ setAppTheme(next);
+ return next;
+}
+
+export function useAppTheme(): AppTheme {
+ return useSyncExternalStore(
+ (onChange) => {
+ subscribers.add(onChange);
+ return () => subscribers.delete(onChange);
+ },
+ () => theme
+ );
+}
diff --git a/src/renderer/src/design/tokens.css b/src/renderer/src/design/tokens.css
index ceb2b3fd..5c9a7883 100644
--- a/src/renderer/src/design/tokens.css
+++ b/src/renderer/src/design/tokens.css
@@ -91,3 +91,41 @@
inset 0 0 0 3px var(--cth-cream-200),
inset 0 0 0 5px var(--cth-ink-900);
}
+
+/* ── Dark theme (v0.3.4) ─────────────────────────────────────────────────────
+ One token swap darkens the WHOLE app: surfaces (cream/paper) go deep
+ ink-purple, the ink text scale inverts to light, accents stay (they read on
+ both). Stamped by design/theme.ts as data-cth-theme on <html>; the terminal
+ palette and per-agent Claude session themes follow the same switch. */
+:root[data-cth-theme='dark'] {
+ /* Base surfaces — darkest where light mode was lightest */
+ --cth-cream-50: #17111D;
+ --cth-cream-100: #1E1626;
+ --cth-cream-200: #291F33;
+ --cth-cream-300: #382B45;
+ --cth-paper-100: #1B141F;
+ --cth-paper-200: #251C2D;
+
+ /* Ink → light text scale */
+ --cth-ink-900: #F2EDE4;
+ --cth-ink-700: #CFC5DA;
+ --cth-ink-500: #9C8CAB;
+ --cth-ink-300: #5D4E6B;
+ --cth-ink-100: #362B42;
+
+ /* Accent "-light" fills double as chip/selection backgrounds — darken them
+ so light text (ink-900) stays readable on top. */
+ --cth-coral-light: #6B3038;
+ --cth-mint-light: #2C5236;
+ --cth-sky-light: #24504C;
+ --cth-lemon-light: #5C4F1D;
+ --cth-lilac-light: #453563;
+ --cth-peach-light: #5E3A28;
+
+ /* Status ghosts sit on cards — keep them dim, not glowing */
+ --cth-status-idle: #6B5878;
+ --cth-status-ghost: #453A52;
+
+ /* Hard shadow reads as void on dark surfaces */
+ --cth-shadow-hard: 4px 4px 0 rgba(0, 0, 0, 0.55);
+}