Skip to content

feat(desktop): custom font family option (rebased #4165)#4194

Merged
esengine merged 1 commit into
main-v2from
pr/4165-custom-font-rebased
Jun 12, 2026
Merged

feat(desktop): custom font family option (rebased #4165)#4194
esengine merged 1 commit into
main-v2from
pr/4165-custom-font-rebased

Conversation

@esengine

Copy link
Copy Markdown
Owner

Lands #4165 (custom font-family option in desktop Appearance settings) on current main-v2, with the review fix applied.

Credit to @myNinety for the feature; folded in @SivanCola's review fix and a small cleanup.

Fixes over #4165

  • Empty-value guard (the issue @SivanCola flagged): selecting Custom before typing a stack — or clearing the textarea — wrote --font-family-custom: (empty), so --sans became , "PingFang SC", … with a leading comma, voiding the whole font-family. Now applyFontFamily removes the property when the name is blank, and the CSS reads var(--font-family-custom, "PingFang SC") so a missing value degrades gracefully.
  • Dropped the redundant double applyFontFamily(font) call in the onFontFamily handler.

What it does

  • New Custom entry in Settings → Appearance → Font family; a textarea takes any CSS font-family stack (e.g. "LXGW WenKai", "JetBrains Mono", monospace), persisted in localStorage and injected as the --font-family-custom CSS variable.
  • Safe by construction: the value is applied via style.setProperty and consumed through var() in a font-family context — var() substitution is token-scoped and can't break out of the declaration, so a bad value only falls back, it can't inject CSS.

Verification (local)

  • pnpm --dir desktop/frontend typecheck — clean apart from the usual ungenerated-wailsjs binding errors that wails generate resolves in CI.
  • pnpm --dir desktop/frontend check:css — green.

Closes #4165

Lets power users type an arbitrary CSS font-family stack (persisted in
localStorage, injected as --font-family-custom). A blank value removes the
property and the CSS falls back via var(), so the stack never begins with a
leading comma that would void the whole font-family.
@esengine esengine requested a review from SivanCola as a code owner June 12, 2026 13:38
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 12, 2026
@esengine esengine merged commit 9480e5a into main-v2 Jun 12, 2026
14 checks passed
@esengine esengine deleted the pr/4165-custom-font-rebased branch June 12, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants