feat(desktop): add configurable terminal font picker - #70925
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
Related: #49592 (salvaged configuration foundation), plus #44564, #64790, and #37566 (adjacent Desktop typography work). This PR has a broader current integration: profile-aware config persistence, live interactive and agent-terminal updates, font warming, and focused coverage; it is not a duplicate. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for preserving the original configuration work and covering both terminal surfaces. The premise is still valid: current main hardcodes the interactive terminal font at apps/desktop/src/app/right-sidebar/terminal/use-terminal-session.ts:509 and the agent-terminal font at apps/desktop/src/app/right-sidebar/terminal/use-agent-terminal.ts:48.
Problems
apps/desktop/src/app/right-sidebar/terminal/use-agent-terminal.ts:14and:18importresolveSurfaceColorandterminalThemetwice. This creates duplicate imported bindings.apps/desktop/src/app/right-sidebar/terminal/use-agent-terminal.ts:47makesobservernullable, while cleanup at:160callsobserver.disconnect()unconditionally. Font preparation is asynchronous (:140-150), so unmounting before mount leavesobservernull and throws in cleanup.
Suggested changes
- Consolidate the two
./selectionimports. - Keep observer cleanup null-safe and add a pending-font-preparation unmount test.
This is an automated hermes-sweeper review.
…mily - Resolved config_defaults.py extraction: accepted main's import in config.py, added font_family default to config_defaults.py - Resolved test_web_server.py: kept PR's four config round-trip tests - Resolved configuration.md: PR's font_family paragraph + main's cloud sandboxes - Fixed duplicate import and observer null-safety in use-agent-terminal.ts (reviewer-flagged code issues)
|
Hi @teknium1, addressed on the latest head 0f128a0:
Focused tests, Desktop typecheck, ESLint, and Prettier checks all pass. |
|
Merged via #76395 — your commits (and the original #49592 base by @baoyu0) were cherry-picked onto current main with authorship preserved (rebase merge). One follow-up commit of ours reworked the settings component to comply with the ref-mirroring lint rule that landed after your PR was authored. Thanks for the thorough end-to-end work — locales, docs, and round-trip tests included. |
What does this PR do?
Adds a profile-scoped terminal font picker to Settings → Appearance so Desktop users can select an installed Nerd Font such as
MesloLGS NFwithout editing CSS.The value is stored as
terminal.font_familyinconfig.yaml. A friendly single family name or custom CSS font stack is accepted, and Hermes always appends the bundled JetBrains Mono stack as a safe fallback. Both interactive terminals and read-only agent terminals warm regular/bold/italic faces before WebGL mounts; live changes refit, clear the glyph atlas, and redraw without recreating the PTY.This salvages #49592: @baoyu0's original config commit remains in the branch with its authorship intact, while the integration is adapted to the current persistent terminal workspace.
Related Issue
Partially addresses #64790 and #37566 (terminal font family only; the broader typography requests remain open).
Type of Change
Changes Made
terminal.font_familyto the public config defaults, Desktop type, example config, and docs.How to Test
MesloLGS NF(or another Nerd Font) locally.MesloLGS NF, and confirm the glyph preview renders separators/icons.Automated validation run:
npm run typechecknpm run lint(no errors; existing repository warnings only)npm run test:ui— 247 files, 2,093 passed, 1 existing skipnpm run buildscripts/run_tests.sh tests/hermes_cli/test_web_server.py -k TestConfigRoundTrip -qChecklist
Code
pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.exampleScreenshots / Logs
On the test Mac,
fc-match "MesloLGS NF"resolvesMesloLGS NF Regular.ttf. The draft is ready for a maintainer/contributor to exercise against a live Powerlevel10k prompt.