The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): size chat text independently of window chrome
Brooklyn Nicholson5cf347c09677
diff --git a/apps/desktop/DESIGN.md b/apps/desktop/DESIGN.mdindex 07cc6fdec08..8dee4331eee 100644--- a/apps/desktop/DESIGN.md+++ b/apps/desktop/DESIGN.md@@ -371,6 +371,16 @@ so glass and message-bubble transparency do not reveal scrolling text.from `src/store/confirm.ts`, which renders this same primitive through thesingle `ConfirmHost` at the shell — the way `notify()` backs notifications.+## Chat typography++Appearance → Typography keeps **UI Scale** as whole-window zoom (90% by+default). **Chat Text Size** is a separate desktop-local multiplier (110% by+default) on conversation text and the composer editor, including floating and+inline-edit composers.+It does not resize the sidebar, settings, toolbars, media, or pane geometry.+Conversation size and line-height tokens are derived inside the transcript/editor+from their root base tokens; do not multiply the global tokens or nest CSS zoom.+## Chat, tools & boot surfaces- The transcript and composer are built on `@assistant-ui/react`. Extend thediff --git a/apps/desktop/src/app/settings/appearance-settings.tsx b/apps/desktop/src/app/settings/appearance-settings.tsxindex fca1c10454e..42fb93cf5fb 100644--- a/apps/desktop/src/app/settings/appearance-settings.tsx+++ b/apps/desktop/src/app/settings/appearance-settings.tsx@@ -16,6 +16,7 @@ import { selectableCardClass } from '@/lib/selectable-card'import { normalize } from '@/lib/text'import { cn } from '@/lib/utils'import { $backdrop, setBackdrop } from '@/store/backdrop'+import { $chatTextScale, CHAT_TEXT_SCALE_PRESETS, setChatTextScale } from '@/store/chat-text-scale'import { $composerPopoutGesturesEnabled, setComposerPopoutGesturesEnabled } from '@/store/composer-popout'import { $embedAllowed, $embedMode, clearEmbedAllowed, type EmbedMode, setEmbedMode } from '@/store/embed-consent'import {@@ -424,6 +425,7 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {const tabStripDefault = useStore($tabStripDefault)const titlebarAppActionsSide = useStore($titlebarAppActionsSide)const zoomPercent = useStore($zoomPercent)+ const chatTextScale = useStore($chatTextScale)const embedMode = useStore($embedMode)const embedAllowed = useStore($embedAllowed)const composerPopoutGesturesEnabled = useStore($composerPopoutGesturesEnabled)@@ -684,6 +686,22 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {title={a.uiScaleTitle}/>+ <ListRow+ action={+ <SegmentedControl+ onChange={value => {+ triggerHaptic('selection')+ setChatTextScale(Number(value))+ }}+ options={CHAT_TEXT_SCALE_PRESETS.map(value => ({ id: String(value), label: `${value}%` }))}+ value={String(chatTextScale)}+ />+ }+ description={a.chatTextScaleDesc}+ id={settingElementId(ids.chatTextScale)}+ title={a.chatTextScaleTitle}+ />+<div id={settingElementId(ids.chatFont)}><ChatFontSetting /></div>diff --git a/apps/desktop/src/app/settings/settings-manifest.ts b/apps/desktop/src/app/settings/settings-manifest.tsindex e1cdea02e18..de7dd99f899 100644--- a/apps/desktop/src/app/settings/settings-manifest.ts+++ b/apps/desktop/src/app/settings/settings-manifest.ts@@ -69,6 +69,7 @@ export const SETTINGS_MANIFEST = {tours: appearanceSetting('general', ['tour', 'walkthrough', 'guide', 'onboarding', 'help'], 'tours'),theme: appearanceSetting('theme', ['color mode', 'skin', 'light', 'dark'], 'theme'),uiScale: appearanceSetting('typography', ['zoom', 'size'], 'uiScale'),+ chatTextScale: appearanceSetting('typography', ['chat', 'text', 'font', 'size', 'scale', 'zoom'], 'chatTextScale'),chatFont: appearanceSetting('typography', ['font', 'typeface', 'family', 'text'], 'chatFont'),terminalFont: appearanceSetting('typography',diff --git a/apps/desktop/src/components/assistant-ui/markdown-table.tsx b/apps/desktop/src/components/assistant-ui/markdown-table.tsxindex 1fcec60002e..062ef588a01 100644--- a/apps/desktop/src/components/assistant-ui/markdown-table.tsx+++ b/apps/desktop/src/components/assistant-ui/markdown-table.tsx@@ -157,7 +157,7 @@ export function ResizableMarkdownTable({ children, className, ...props }: Compon<div className="aui-md-table my-2 max-w-full overflow-x-auto rounded-[0.375rem] border border-(--ui-stroke-tertiary)"><tableclassName={cn(- 'm-0 w-full min-w-[18rem] border-collapse text-[0.8125rem] [&_tr]:border-b [&_tr]:border-(--ui-stroke-tertiary) last:[&_tr]:border-0',+ 'm-0 w-full min-w-[18rem] border-collapse text-[length:var(--conversation-text-font-size)] [&_tr]:border-b [&_tr]:border-(--ui-stroke-tertiary) last:[&_tr]:border-0',widths && 'table-fixed [&_td]:wrap-anywhere',className)}@@ -183,7 +183,7 @@ export function ResizableMarkdownTh({ children, className, ...props }: Componentreturn (<thclassName={cn(- 'relative px-2.5 py-1.5 text-left align-middle text-[0.75rem] font-medium text-muted-foreground',+ 'relative px-2.5 py-1.5 text-left align-middle text-[length:var(--conversation-caption-font-size)] font-medium text-muted-foreground',// The trailing column has no seam: its right edge is the table's edge,// and there is nothing on the far side to trade width with.'[&:last-child_[data-md-col-handle]]:hidden',diff --git a/apps/desktop/src/components/assistant-ui/markdown-text.tsx b/apps/desktop/src/components/assistant-ui/markdown-text.tsxindex ada919bdfb2..04828de47e6 100644--- a/apps/desktop/src/components/assistant-ui/markdown-text.tsx+++ b/apps/desktop/src/components/assistant-ui/markdown-text.tsx@@ -513,10 +513,10 @@ interface MarkdownTextSurfaceProps {// Headings shrink to chat scale rather than the prose default (h1≈xl). Kept// table-driven so adding/tweaking levels is one row.const HEADING_SIZES: Record<'h1' | 'h2' | 'h3' | 'h4', string> = {- h1: 'text-[1rem] tracking-tight',- h2: 'text-[0.9375rem] tracking-tight',- h3: 'text-[0.875rem]',- h4: 'text-[0.8125rem]'+ h1: 'text-[length:calc(1rem*var(--conversation-text-scale,1))] tracking-tight',+ h2: 'text-[length:calc(0.9375rem*var(--conversation-text-scale,1))] tracking-tight',+ h3: 'text-[length:calc(0.875rem*var(--conversation-text-scale,1))]',+ h4: 'text-[length:var(--conversation-text-font-size)]'}const MARKDOWN_CONTAINER_CLASS_NAME = cn(@@ -731,7 +731,13 @@ function MarkdownTextSurface({),th: ResizableMarkdownTh,td: ({ children, className, ...props }: ComponentProps<'td'>) => (- <td className={cn('px-2.5 py-1.5 align-top text-[0.8125rem] leading-snug', className)} {...props}>+ <td+ className={cn(+ 'px-2.5 py-1.5 align-top text-[length:var(--conversation-text-font-size)] leading-snug',+ className+ )}+ {...props}+ >{decorateText ? decorateText(children) : children}</td>),diff --git a/apps/desktop/src/components/chat/code-card.tsx b/apps/desktop/src/components/chat/code-card.tsxindex a83fc6cfb13..880413801a2 100644--- a/apps/desktop/src/components/chat/code-card.tsx+++ b/apps/desktop/src/components/chat/code-card.tsx@@ -36,7 +36,7 @@ function CodeCardBody({ className, ...props }: React.ComponentProps<'div'>) {return (<divclassName={cn(- 'font-mono text-[0.7rem] leading-relaxed text-foreground/90 [&_pre]:m-0 [&_pre]:overflow-x-auto [&_pre]:scrollbar-overlay [&_pre]:bg-transparent! [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:font-mono [&_pre]:leading-relaxed',+ 'font-mono text-[length:calc(0.7rem*var(--conversation-text-scale,1))] leading-relaxed text-foreground/90 [&_pre]:m-0 [&_pre]:overflow-x-auto [&_pre]:scrollbar-overlay [&_pre]:bg-transparent! [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:font-mono [&_pre]:leading-relaxed',className)}data-slot="code-card-body"diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex 3102ae85c8c..dbbf6f99046 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -720,6 +720,9 @@ export const ar = defineLocale({}},appearance: {+ chatTextScaleTitle: 'حجم نص المحادثة',+ chatTextScaleDesc:+ 'يضبط حجم نص المحادثة ومحرر الرسائل نسبةً إلى مقياس الواجهة. يبقى حجم الأشرطة الجانبية وعناصر التحكم كما هو.',title: 'المظهر',intro: 'خصص مظهر Hermes Desktop.',colorMode: 'نمط الألوان',diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex b2d1131a179..30abb1805e0 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -1133,6 +1133,9 @@ export const deOverrides = {}},appearance: {+ chatTextScaleTitle: 'Chat-Textgröße',+ chatTextScaleDesc:+ 'Skaliert Unterhaltungstext und Nachrichteneingabe relativ zur UI-Skalierung. Seitenleisten und Bedienelemente behalten ihre Größe.',title: 'Darstellung',intro: 'Nur für Desktop. Modus ist die Helligkeit; Theme ist Farbpalette und Chat-Design.',colorMode: 'Farbmodus',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 11e74c33c4b..343ccbf9d3e 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -1165,6 +1165,9 @@ export const en: Translations = {system: { label: 'System', description: 'Follow OS appearance' }},appearance: {+ chatTextScaleTitle: 'Chat Text Size',+ chatTextScaleDesc:+ 'Scales conversation text and the message editor relative to UI Scale. Sidebars and controls stay the same size.',title: 'Appearance',intro: 'Desktop-only. Mode is brightness; theme is palette and chat chrome.',colorMode: 'Color Mode',diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex 11ba0c0e735..8192265ed5b 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -1134,6 +1134,9 @@ export const esOverrides = {}},appearance: {+ chatTextScaleTitle: 'Tamaño del texto del chat',+ chatTextScaleDesc:+ 'Ajusta el texto de la conversación y del editor respecto a la escala de la interfaz. Las barras laterales y los controles mantienen su tamaño.',title: 'Apariencia',intro: 'Solo escritorio. El modo es el brillo; el tema es la paleta y el marco del chat.',colorMode: 'Modo de color',diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 4ca2f751e96..9b36e260f95 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -1134,6 +1134,9 @@ export const frOverrides = {}},appearance: {+ chatTextScaleTitle: 'Taille du texte du chat',+ chatTextScaleDesc:+ 'Ajuste le texte des conversations et de la saisie par rapport à l’échelle de l’interface. Les barres latérales et les contrôles gardent leur taille.',title: 'Apparence',intro:'Exclusif au desktop. Le mode contrôle la luminosité ; le thème contrôle la palette et le chrome de la conversation.',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 9d7e830f4e9..7482ae6c254 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -688,6 +688,9 @@ export const ja = defineLocale({system: { label: 'システム', description: 'OS の外観に合わせる' }},appearance: {+ chatTextScaleTitle: 'チャットの文字サイズ',+ chatTextScaleDesc:+ 'UI スケールを基準に、会話とメッセージ入力欄の文字を拡大縮小します。サイドバーや操作ボタンのサイズは変わりません。',title: '外観',intro:'デスクトップ専用の表示設定です。モードは明るさ、テーマはアクセントカラーとチャット面のスタイルを制御します。',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 37204e6bef2..f29eb46e54c 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -720,6 +720,9 @@ export const ru = defineLocale({system: { label: 'Системная', description: 'Следовать настройкам ОС' }},appearance: {+ chatTextScaleTitle: 'Размер текста чата',+ chatTextScaleDesc:+ 'Масштабирует текст беседы и поле ввода относительно масштаба интерфейса. Размер боковых панелей и элементов управления не меняется.',title: 'Внешний вид',intro: 'Только для приложения. Режим — это яркость, тема — палитра и оформление чата.',colorMode: 'Цветовой режим',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex e51603e5f01..9e66e1b2698 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -974,6 +974,8 @@ export interface Translations {hideThreadTimelineDesc: stringreasoningCollapsedTitle: stringreasoningCollapsedDesc: string+ chatTextScaleTitle: string+ chatTextScaleDesc: stringuiScaleTitle: stringuiScaleDesc: (percent: number) => stringsessionDensityTitle: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex 98373973b64..f471cd22737 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -634,6 +634,8 @@ export const zhHant = defineLocale({system: { label: '跟隨系統', description: '跟隨作業系統外觀' }},appearance: {+ chatTextScaleTitle: '聊天文字大小',+ chatTextScaleDesc: '相對於介面縮放調整對話文字和訊息輸入框的字級。側邊欄與控制項大小保持不變。',title: '外觀',intro: '這些是僅限桌面端的顯示偏好。模式控制亮度;主題控制強調色與聊天介面樣式。',colorMode: '色彩模式',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 22c0773ac14..f12c03c5fc2 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -850,6 +850,8 @@ export const zh = defineLocale({system: { label: '跟随系统', description: '跟随系统外观' }},appearance: {+ chatTextScaleTitle: '聊天文字大小',+ chatTextScaleDesc: '相对于界面缩放调整对话文字和消息输入框的字号。侧边栏和控件大小保持不变。',title: '外观',intro: '这些是仅桌面端的显示偏好。模式控制明暗;主题控制强调色与对话界面样式。',colorMode: '颜色模式',diff --git a/apps/desktop/src/main.tsx b/apps/desktop/src/main.tsxindex de7ba95e11c..ba7996e704d 100644--- a/apps/desktop/src/main.tsx+++ b/apps/desktop/src/main.tsx@@ -7,6 +7,8 @@ import './store/power'import './store/translucency'// Side-effect: applies the persisted user-bubble transparency on load.import './store/user-bubble-transparency'+// Side-effect: restores chat typography before the first conversation paints.+import './store/chat-text-scale'// Dev-only render/state churn counters. MUST precede the `react-dom` import// below: react-dom captures the devtools hook at module init, so bippy has to// install during THIS import's evaluation or every commit goes unseendiff --git a/apps/desktop/src/store/chat-text-scale.test.ts b/apps/desktop/src/store/chat-text-scale.test.tsnew file mode 100644index 00000000000..fd420741b62--- /dev/null+++ b/apps/desktop/src/store/chat-text-scale.test.ts@@ -0,0 +1,48 @@+import { beforeEach, expect, it, vi } from 'vitest'++const KEY = 'hermes.desktop.chat-text-scale.v1'++beforeEach(() => {+ vi.resetModules()+ localStorage.clear()+ document.documentElement.style.removeProperty('--chat-text-scale')+})++it('restores the selected chat scale without changing window zoom or global typography', async () => {+ const { $zoomPercent } = await import('./zoom')+ const zoom = $zoomPercent.get()+ const root = document.documentElement+ root.style.setProperty('--conversation-text-font-size', '13px')+ const { $chatTextScale, setChatTextScale, CHAT_TEXT_SCALE_PRESETS } = await import('./chat-text-scale')+ const selected = CHAT_TEXT_SCALE_PRESETS.find(value => value !== $chatTextScale.get())!++ setChatTextScale(selected)++ expect(root.style.getPropertyValue('--chat-text-scale')).toBe(String(selected / 100))+ expect(root.style.getPropertyValue('--conversation-text-font-size')).toBe('13px')+ expect($zoomPercent.get()).toBe(zoom)+ expect(localStorage.getItem(KEY)).toBe(String(selected))++ vi.resetModules()+ const restored = await import('./chat-text-scale')+ expect(restored.$chatTextScale.get()).toBe(selected)+ root.style.removeProperty('--conversation-text-font-size')+})++it('falls back to the default for invalid storage and keeps an explicit 100% selection', async () => {+ const initial = await import('./chat-text-scale')+ const fallback = initial.$chatTextScale.get()++ localStorage.setItem(KEY, 'not-a-scale')+ vi.resetModules()+ const { $chatTextScale, setChatTextScale } = await import('./chat-text-scale')+ expect($chatTextScale.get()).toBe(fallback)+ expect(document.documentElement.style.getPropertyValue('--chat-text-scale')).toBe(String(fallback / 100))++ setChatTextScale(100)+ vi.resetModules()+ const restored = await import('./chat-text-scale')+ expect(restored.$chatTextScale.get()).toBe(100)+ restored.setChatTextScale(fallback)+ expect(localStorage.getItem(KEY)).toBeNull()+})diff --git a/apps/desktop/src/store/chat-text-scale.ts b/apps/desktop/src/store/chat-text-scale.tsnew file mode 100644index 00000000000..0e845d8a8c5--- /dev/null+++ b/apps/desktop/src/store/chat-text-scale.ts@@ -0,0 +1,27 @@+import { atom } from 'nanostores'++import { persistString, storedString } from '@/lib/storage'++const KEY = 'hermes.desktop.chat-text-scale.v1'+const DEFAULT_CHAT_TEXT_SCALE = 110++export const CHAT_TEXT_SCALE_PRESETS = [90, 100, 110, 125, 150, 175] as const+export type ChatTextScale = (typeof CHAT_TEXT_SCALE_PRESETS)[number]++function normalizeChatTextScale(value: unknown): ChatTextScale {+ return CHAT_TEXT_SCALE_PRESETS.find(preset => preset === Number(value)) ?? DEFAULT_CHAT_TEXT_SCALE+}++export const $chatTextScale = atom<ChatTextScale>(normalizeChatTextScale(storedString(KEY)))++export function setChatTextScale(value: number): void {+ $chatTextScale.set(normalizeChatTextScale(value))+}++// Desktop-local presentation, independent of the window zoom and active profile.+if (typeof window !== 'undefined') {+ $chatTextScale.subscribe(value => {+ document.documentElement.style.setProperty('--chat-text-scale', String(value / 100))+ persistString(KEY, value === DEFAULT_CHAT_TEXT_SCALE ? null : String(value))+ })+}diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.cssindex 9c9a3a89b73..212c2a8ff31 100644--- a/apps/desktop/src/styles.css+++ b/apps/desktop/src/styles.css@@ -508,11 +508,16 @@--composer-shell-pad-block-end: 0.625rem;--message-text-indent: 0.75rem;- --conversation-text-font-size: 0.8125rem;- --conversation-tool-font-size: 0.6875rem;- --conversation-caption-font-size: 0.75rem;- --conversation-line-height: 1.125rem;- --conversation-caption-line-height: 1rem;+ --conversation-text-base-size: 0.8125rem;+ --conversation-tool-base-size: 0.6875rem;+ --conversation-caption-base-size: 0.75rem;+ --conversation-base-line-height: 1.125rem;+ --conversation-caption-base-line-height: 1rem;+ --conversation-text-font-size: var(--conversation-text-base-size);+ --conversation-tool-font-size: var(--conversation-tool-base-size);+ --conversation-caption-font-size: var(--conversation-caption-base-size);+ --conversation-line-height: var(--conversation-base-line-height);+ --conversation-caption-line-height: var(--conversation-caption-base-line-height);--conversation-turn-gap: 0.375rem;/* Gap between top-level turn blocks (prose ↔ tools ↔ thinking) — enough airthat scaffolding reads as separate from the reply, not crammed into it. */@@ -1631,6 +1636,18 @@ body.guest-pointer-lock :is(webview, iframe) {/* Bottom clearance lives on [data-slot='aui_composer-clearance'] —virtualized items unmount, so :nth-last-child can't fire reliably. */+/* Scope typography, not zoom: pane geometry and surrounding chrome stay put.+ The editor owns its scope too, including inline edits and floating composers. */+[data-slot='aui_thread-content'],+[data-slot='composer-rich-input'] {+ --conversation-text-scale: var(--chat-text-scale, 1);+ --conversation-text-font-size: calc(var(--conversation-text-base-size) * var(--chat-text-scale, 1));+ --conversation-tool-font-size: calc(var(--conversation-tool-base-size) * var(--chat-text-scale, 1));+ --conversation-caption-font-size: calc(var(--conversation-caption-base-size) * var(--chat-text-scale, 1));+ --conversation-line-height: calc(var(--conversation-base-line-height) * var(--chat-text-scale, 1));+ --conversation-caption-line-height: calc(var(--conversation-caption-base-line-height) * var(--chat-text-scale, 1));+}+[data-slot='aui_assistant-message-content'] {padding-left: var(--message-text-indent);font-size: var(--conversation-text-font-size);@@ -2004,7 +2021,7 @@ body.guest-pointer-lock :is(webview, iframe) {[data-slot='composer-rich-input'] {color: var(--ui-text-primary);- font-size: 0.8125rem;+ font-size: var(--conversation-text-font-size);}[data-slot='composer-rich-input']:is(:empty, [data-empty])::before {diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.jsonindex eb4f04a55e1..465cc8c057e 100644--- a/locales/_keys.desktop.json+++ b/locales/_keys.desktop.json@@ -2480,6 +2480,8 @@"settings.appearance.chatFontReset","settings.appearance.chatFontSample","settings.appearance.chatFontTitle",+ "settings.appearance.chatTextScaleDesc",+ "settings.appearance.chatTextScaleTitle","settings.appearance.colorMode","settings.appearance.colorModeDesc","settings.appearance.composerPopoutDesc",