Skip to content

fix: add configurable terminal font family - #116

Closed
BearHuddleston wants to merge 4 commits into
collabs-inc:mainfrom
BearHuddleston:BearHuddleston/wslg-terminal-fonts
Closed

fix: add configurable terminal font family#116
BearHuddleston wants to merge 4 commits into
collabs-inc:mainfrom
BearHuddleston:BearHuddleston/wslg-terminal-fonts

Conversation

@BearHuddleston

@BearHuddleston BearHuddleston commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the embedded terminal font configurable from Settings so users can explicitly choose a Nerd Font such as FiraCode Nerd Font Mono, while keeping fallback composition and updating open terminals when the preference changes.

Why

The terminal still defaulted to a generic Menlo/Monaco/Courier stack, so installing a Nerd Font alone was not enough to make icon-heavy TUIs render with the intended font. Instead of auto-picking a detected font, this change makes the preference explicit and user-controlled.

What changed

  • Added a shared terminal font helper that composes a single requested family with the existing fallback stack.
  • Updated the xterm terminal view to resolve terminalFontFamily from prefs and react to pref:changed so open terminals pick up the new font immediately.
  • Broadcast preference changes to all webContents and exposed onPrefChanged in the universal preload API.
  • Added a Terminal font family field in Settings with common suggestions and reset behavior.
  • Added focused tests for terminal font resolution and duplicate suppression.

Validation

  • bun test packages/shared/src/terminal-font.test.ts
  • bun x tsc --noEmit --pretty false

Notes

  • This does not install fonts for the user. The chosen font still has to be installed where the embedded Chromium renderer can see it.
  • Single-family entries like FiraCode Nerd Font Mono are expanded with the built-in fallback stack automatically.

Video

2026-04-07.21-43-57.mp4

@BearHuddleston BearHuddleston changed the title fix: prefer mono nerd fonts in terminal fix: add configurable terminal font family Apr 8, 2026
@BearHuddleston
BearHuddleston marked this pull request as ready for review April 8, 2026 03:04
@BearHuddleston

Copy link
Copy Markdown
Contributor Author

@yiliushenburke Ready 🐻

# Conflicts:
#	collab-electron/packages/components/src/Terminal/TerminalTab.tsx
#	collab-electron/packages/shared/src/terminal-font.test.ts
#	collab-electron/packages/shared/src/terminal-font.ts
#	collab-electron/src/windows/settings/src/App.tsx
@BearHuddleston
BearHuddleston force-pushed the BearHuddleston/wslg-terminal-fonts branch from 66c963c to bddfee7 Compare April 8, 2026 03:30
@theblondealex

Copy link
Copy Markdown
Contributor

looks pretty good to me

@yiliush

yiliush commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Thx @BearHuddleston (and @theblondealex)! Taking a look shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants