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
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
fix(focus mode): notify TUIs from the focus-mode theme toggle too, and stop saying fullscreen
Chaitanya Giri77539acd4831
diff --git a/src/renderer/src/components/FullscreenTerminal.tsx b/src/renderer/src/components/FullscreenTerminal.tsxindex 5ea0dfad..28187002 100644--- a/src/renderer/src/components/FullscreenTerminal.tsx+++ b/src/renderer/src/components/FullscreenTerminal.tsx@@ -16,7 +16,7 @@ import { useStore, type Agent } from '@/store/store';import { usePtyParser } from '@/hooks/usePtyParser';import { useRestoreTeam } from '@/hooks/useRestoreTeam';import { useTerminalFontSize } from './terminalFontSize';-import { useHasTerminalDraft, disposeTerminal, reflowTerminal } from './terminalPool';+import { useHasTerminalDraft, disposeTerminal, reflowTerminal, notifyThemeChangeAll } from './terminalPool';import { useAppTheme, toggleAppTheme } from '@/design/theme';import type { HarnessConfig } from '@/store/config';@@ -296,7 +296,7 @@ export function FullscreenTerminal({ config }: FullscreenTerminalProps) {<span style={{fontFamily: 'var(--cth-font-display)', fontSize: 12, lineHeight: '20px',color: 'var(--cth-ink-900)'- }}>MUNDER DIFFLIN · FULLSCREEN</span>+ }}>MUNDER DIFFLIN · FOCUS MODE</span>{/* Same top-right controls as the main title bar — fullscreen coversit, so theme / exit-fullscreen / IDE must live here too. */}<div className="cth-titlebar-nodrag" style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center', gap: 12 }}>@@ -322,6 +322,10 @@ export function FullscreenTerminal({ config }: FullscreenTerminalProps) {onClick={() => {const next = toggleAppTheme();void window.cth.updateConfig({ terminalTheme: next });+ // Focus mode has its OWN theme button, so notifying only from the+ // title-bar toggle meant a flip made from in here never reached a+ // running TUI. Both entry points must tell them.+ notifyThemeChangeAll(next === 'dark' ? 'dark' : 'light');}}title={appThemeNow === 'dark' ? 'Switch to the light theme' : 'Switch to the dark theme'}aria-label="Toggle dark mode"diff --git a/src/renderer/src/components/terminalPool.ts b/src/renderer/src/components/terminalPool.tsindex 08f29388..7046d6c2 100644--- a/src/renderer/src/components/terminalPool.ts+++ b/src/renderer/src/components/terminalPool.ts@@ -96,7 +96,11 @@ type ThemeMap = Record<string, string>;* xterm's own cells flip, and everything the program painted explicitly does* not. */export function notifyThemeChangeAll(theme: 'light' | 'dark'): void {- for (const ptyId of pool.keys()) notifyThemeChange(ptyId, theme);+ const all = [...pool.keys()];+ const told = all.filter((id) => pool.get(id)?.themeNotify);+ console.log(`[theme] -> ${theme}: notified ${told.length}/${all.length} terminal(s)`+ + (told.length ? ` (${told.join(', ')})` : ' — none opted into DEC 2031'));+ for (const ptyId of all) notifyThemeChange(ptyId, theme);}function notifyThemeChange(ptyId: string, theme: 'light' | 'dark'): void {@@ -296,7 +300,13 @@ export function acquireTerminal(ptyId: string, theme?: ThemeMap, fontSize = 14):// which is why flipping the app theme left OpenCode's boxes in the old colours.// Return false so xterm still applies the mode itself; we are only listening.term.parser.registerCsiHandler({ prefix: '?', final: 'h' }, (params) => {- if (params.includes(2031)) entry.themeNotify = true;+ if (params.includes(2031)) {+ entry.themeNotify = true;+ // Deliberately logged. Whether a TUI opts in is the difference between "the+ // theme fix works" and "we are talking to something that is not listening",+ // and that is not observable from the outside.+ console.log(`[theme] ${ptyId} enabled theme-change notifications (DEC 2031)`);+ }return false;});term.parser.registerCsiHandler({ prefix: '?', final: 'l' }, (params) => {