feat(desktop): add configurable terminal font family (terminal.font_family in config.yaml) - #49592
feat(desktop): add configurable terminal font family (terminal.font_family in config.yaml)#49592baoyu0 wants to merge 1 commit into
Conversation
…amily in config.yaml)
Adds a new config option terminal.font_family that lets users customize the
CSS font-family for the desktop app's embedded xterm.js terminal.
Previously the font was hardcoded in use-terminal-session.ts:
'JetBrains Mono', 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace
Now the value from config.yaml (terminal.font_family) is threaded through:
useHermesConfig → PersistentTerminal → TerminalTab → useTerminalSession
When font_family is empty or unset (default), the built-in fallback is used,
preserving backward compatibility. Users with Nerd Fonts installed (e.g.
CaskaydiaCoveNerdFont) can now set:
terminal:
font_family: 'CaskaydiaCoveNerdFont', 'JetBrains Mono', monospace
Closes: #terminal-font-config
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused configuration contribution. The need still exists: current main hardcodes the interactive xterm font at apps/desktop/src/app/right-sidebar/terminal/use-terminal-session.ts:504.
Problems
- The PR targets the old
TerminalTabtree. Current main instead mountsTerminalWorkspacefrompersistent.tsx:136, which rendersTerminalInstanceinworkspace.tsx:53-61; the changedterminal/index.tsxno longer exists. GitHub reports this PR asDIRTY. - At commit
98191306,use-hermes-config.ts:31,69initializes the font as''and fills it asynchronously, butuse-terminal-session.ts:658does not depend onfontFamily. If xterm is created first, it keeps the fallback font. - Current startup intentionally warms fonts before fitting and starting the PTY (
use-terminal-session.ts:884-892); a custom family needs to participate in that path.
Suggested changes
- Adapt the plumbing to the current
PersistentTerminal → TerminalWorkspace → TerminalInstance → useTerminalSessionpath. - Add an update path that applies the resolved font, warms it, refits, and refreshes WebGL without restarting persistent terminals; cover delayed config resolution.
- Decide whether the same setting should apply to the agent-background xterm at
use-agent-terminal.ts:44.
Automated hermes-sweeper review.
| convertEol: true, | ||
| cursorBlink: true, | ||
| fontFamily: "'JetBrains Mono', 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace", | ||
| fontFamily: fontFamily || "'JetBrains Mono', 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace", |
There was a problem hiding this comment.
terminalFontFamily starts as '' and is set only after the asynchronous config request resolves, while this xterm-construction effect does not depend on fontFamily (line 658). If the terminal mounts first, it remains on the fallback for the session. Add a dedicated font-update path that also refits and clears the WebGL atlas; simply recreating the persistent terminal on every config response would discard shell state.
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Three PRs address the hardcoded Desktop terminal font: #49592 adds the initial config plumbing, #70925 expands it into a profile-scoped picker with lifecycle handling and tests, and #76395 carries that broader implementation onto current main.
Related pull requests
- #49592
related— (+25/-8) — superseded by #76395: #49592 introducesterminal.font_familybut targets the removedTerminalTabpath and does not update an xterm instance when the asynchronously loaded font changes. Despite the keep_open review on #49592, #76395 implements the salvage path requested there through the current terminal hooks, including font warming and live updates. - #70925 [closed]
related— (+1078/-30) — superseded by #76395: #70925 provides the comprehensive picker, profile persistence, both interactive and agent-terminal integration, font warming, live repaint, documentation, and tests. Despite the keep_open review on #70925, the #76395 diff contains the same core implementation while resolving the review's duplicate-import and nullable-observer cleanup blockers; #70925 remains relevant as the source branch identified as salvaged in the #76395 PR body and as superseded by #76395 in the contributor discussion on #70925. - #76395 [merged]
related— (+1009/-30) — implemented reference: #76395 is the current-main implementation of configurable terminal fonts, covering both terminal surfaces, profile-scoped settings, safe fallback resolution, asynchronous warming, live repaint, config round-trip coverage, locales, and documentation. Its merged state makes it the reference that supersedes the two earlier proposals.
Duplicates
#70925 and #76395 are substantially the same end-to-end change, with #76395 carrying the implementation onto current main and resolving the documented review blockers. #49592 is the narrower configuration foundation whose intended behavior is subsumed by #76395.
Suggested consolidation
Close #49592 as duplicate of #76395: the chain is #49592 → #70925 → #76395, and the #76395 diff contains the current-tree implementation requested by the keep_open review on #49592. Keep #70925 closed as superseded by #76395; its keep_open review was appropriate before the duplicate imports and nullable-observer cleanup issue were addressed, but those fixes and the pending-font-preparation unmount test are present in #76395.
Cross-PR triage: Reviewed 3 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 116 kB of PR diffs, 8 kB of issue/PR text, 5 kB of discussion (10 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
Summary
Adds a new config option
terminal.font_familythat lets users customize the CSS font-family for the desktop app's embedded xterm.js terminal.Problem
The embedded terminal font was hardcoded to:
None of these are Nerd Fonts, so Nerd Font-only glyphs (like Starship prompt icons for the Windows logo) render as tofu/boxes. Users who have Nerd Fonts installed cannot configure the terminal to use them without patching the built desktop app JS.
Solution
Thread a new config value
terminal.font_familyfromconfig.yamlthrough to the xterm.js Terminal constructor:hermes_cli/config.py): added"font_family": ""to the terminal section ofDEFAULT_CONFIGtypes/hermes.ts): addedfont_family?: stringtoHermesConfig.terminaluse-hermes-config.ts): readsconfig.terminal?.font_familyand exposes it asterminalFontFamilydesktop-controller.tsx->persistent.tsx->index.tsx->use-terminal-session.ts): passes the value down to the Terminal constructorUsage
After restarting the desktop app, Nerd Font icons in the embedded terminal will render correctly.
Files changed
hermes_cli/config.py- addedfont_familydefault + documentationapps/desktop/src/types/hermes.ts- added typeapps/desktop/src/app/session/hooks/use-hermes-config.ts- reads config valueapps/desktop/src/app/desktop-controller.tsx- wires value to terminalapps/desktop/src/app/right-sidebar/terminal/persistent.tsx- passes throughapps/desktop/src/app/right-sidebar/terminal/index.tsx- passes throughapps/desktop/src/app/right-sidebar/terminal/use-terminal-session.ts- uses config value with fallbackapps/desktop/src/app/settings/constants.ts- field label + description for Settings UITesting
font_familyis unset or empty, behavior is identical to before