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(appearance): option to hide the model & context meter (#1222)
eneskirca19ed67c96c49
diff --git a/src/renderer/components/ContextMeter.test.tsx b/src/renderer/components/ContextMeter.test.tsxindex 65a082094..e537c1395 100644--- a/src/renderer/components/ContextMeter.test.tsx+++ b/src/renderer/components/ContextMeter.test.tsx@@ -45,3 +45,22 @@ it('shows only the requested SSH node even when local and remote rollouts shareawait act(async () => root.unmount())}})++// Issue #1141: "Model & context meter" in Settings → Appearance → Terminal header buttons hides+// the pill everywhere this component renders (node header, kanban card, card modal).+it('renders nothing when the context meter is hidden in Appearance', async () => {+ const el = document.createElement('div')+ const root = createRoot(el)+ const usage = { sessionId: 'h', usedTokens: 10, windowTokens: 100, usedPercent: 10, model: 'm', updatedAt: Date.now(), windowSource: 'transcript' as const }+ useContextWindow.getState().set(usage)+ try {+ useSettings.setState(s => ({ settings: { ...s.settings, hiddenHeaderButtons: [] } }))+ await act(async () => root.render(<ContextMeter sessionId="h" />))+ expect(el.querySelector('button')).not.toBeNull()+ await act(async () => { useSettings.setState(s => ({ settings: { ...s.settings, hiddenHeaderButtons: ['context-meter'] } })) })+ expect(el.querySelector('.ctx-meter')).toBeNull()+ } finally {+ useSettings.setState(s => ({ settings: { ...s.settings, hiddenHeaderButtons: [] } }))+ await act(async () => root.unmount())+ }+})diff --git a/src/renderer/components/ContextMeter.tsx b/src/renderer/components/ContextMeter.tsxindex edbe0dcdf..40e4b11fc 100644--- a/src/renderer/components/ContextMeter.tsx+++ b/src/renderer/components/ContextMeter.tsx@@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react'import { useContextUsage } from '../state/contextWindow'import { useSettings } from '../state/settings'import { capabilityAgentId } from '@shared/agents/config'+import { isHidden } from '../lib/ui-visibility'import { barFillPercent, contextFillColor, contextPillText, formatModelLabel, formatTimeAgo, formatTokensShort, percentText } from '../lib/usageFormat'/**@@ -22,6 +23,9 @@ export function ContextMeter({ sessionId, nodeId, remote = false, agentId, fromL// to the node that requested them; never fall back to a local/session-only snapshot.const usage = useContextUsage({ sessionId, nodeId, scoped })const percentMode = useSettings((s) => s.settings.usagePercentMode)+ // Issue #1141: hideable from Settings → Appearance (same list as the header buttons). Read here+ // rather than at the three call sites so the header, the card and the modal cannot disagree.+ const hiddenByUser = useSettings((s) => isHidden('context-meter', s.settings.hiddenHeaderButtons))const [open, setOpen] = useState(false)const ref = useRef<HTMLDivElement>(null)@@ -34,7 +38,7 @@ export function ContextMeter({ sessionId, nodeId, remote = false, agentId, fromLreturn () => window.removeEventListener('mousedown', onDown)}, [open])- if (!usage) return null+ if (!usage || hiddenByUser) return null// The NUMBER honours the used/remaining/tokens display setting; the bar and its color stay// keyed to context FILL, so the severity colors keep meaning the same thing in every mode// (issue #78).diff --git a/src/renderer/components/settings/sections/AppearanceSection.tsx b/src/renderer/components/settings/sections/AppearanceSection.tsxindex 2d59e72e0..b0ce30d6e 100644--- a/src/renderer/components/settings/sections/AppearanceSection.tsx+++ b/src/renderer/components/settings/sections/AppearanceSection.tsx@@ -119,7 +119,7 @@ const ROWS = {},headerButtons: {title: 'Terminal header buttons',- keywords: ['terminal', 'header', 'buttons', 'icons', 'hide']+ keywords: ['terminal', 'header', 'buttons', 'icons', 'hide', 'context', 'meter', 'model', 'usage']},reset: {title: 'Reset appearance',@@ -634,7 +634,8 @@ export function AppearanceSection({ isActive }: { isActive: boolean }): React.JS<div><h4 className="text-[13px] font-medium text-text">Terminal header buttons</h4><p className="mt-1 text-[13px] leading-relaxed text-muted">- Which icon buttons the terminal node header shows. Close and the terminal Search+ Which icon buttons the terminal node header shows. The model & context meter+ hides on kanban cards and in the card modal too. Close and the terminal Searchbutton are always shown, as are the right-click menu's destructive and recoveryactions (Delete, Restart agent).</p>diff --git a/src/renderer/lib/ui-visibility.test.ts b/src/renderer/lib/ui-visibility.test.tsindex 7f12ef4c4..4906a34ba 100644--- a/src/renderer/lib/ui-visibility.test.ts+++ b/src/renderer/lib/ui-visibility.test.ts@@ -14,6 +14,10 @@ describe('isHidden', () => {for (const id of ['delete', 'restart-agent', 'search', 'close', 'branch'])expect(isHidden(id, [id])).toBe(false)})+ it('reads a hand-edited non-array value as nothing hidden', () => {+ for (const bad of [5, 'context-meter', null, undefined, { 'context-meter': true }])+ expect(isHidden('context-meter', bad as unknown as string[])).toBe(false)+ })it('ignores unknown ids in the list', () => {expect(isHidden('duplicate', ['nonsense', 'duplicate'])).toBe(true)expect(isHidden('nonsense', ['nonsense'])).toBe(false)@@ -27,7 +31,7 @@ describe('hideable inventories', () => {'markdown-view', 'refresh-terminal', 'live-link', 'vanilla-restart'])expect(HIDEABLE_HEADER_BUTTONS.map((r) => r.id)).toEqual([- 'maximize', 'refresh', 'mic', 'ai-name', 'comments', 'share-link', 'hide-fanout', 'tidy-fanout', 'md-hint'+ 'context-meter', 'maximize', 'refresh', 'mic', 'ai-name', 'comments', 'share-link', 'hide-fanout', 'tidy-fanout', 'md-hint'])})it('gives every entry a user-facing label', () => {diff --git a/src/renderer/lib/ui-visibility.ts b/src/renderer/lib/ui-visibility.tsindex 93be42ce1..290d865f5 100644--- a/src/renderer/lib/ui-visibility.ts+++ b/src/renderer/lib/ui-visibility.ts@@ -36,6 +36,10 @@ export const HIDEABLE_MENU_ITEMS: readonly HideableRow[] = [/** Hideable terminal node header buttons, in header order. */export const HIDEABLE_HEADER_BUTTONS: readonly HideableRow[] = [+ // Not a button but the model + context-usage pill (issue #1141). `ContextMeter` asks this id+ // itself, so it hides on all three places the pill is drawn: node header, kanban card, card+ // modal. Display only — usage tracking and the ⌘M composer's model label are unaffected.+ { id: 'context-meter', label: 'Model & context meter' },{ id: 'maximize', label: 'Maximize' },{ id: 'refresh', label: 'Refresh' },{ id: 'mic', label: 'Dictate' },@@ -61,5 +65,7 @@ const HIDEABLE_IDS = new Set<string>(* ignored, and an id outside the inventory stays visible no matter what the list says.*/export function isHidden(id: string, hidden: readonly string[]): boolean {- return HIDEABLE_IDS.has(id) && hidden.includes(id)+ // settings.json is hand-editable and nothing normalizes these two lists on load: a non-array+ // value must read as "nothing hidden", not throw inside a node header's render.+ return HIDEABLE_IDS.has(id) && Array.isArray(hidden) && hidden.includes(id)}