Add file-backed appearance config for font overrides #464
main fromrefs/pull/464/head·opened View on GitHubSummary#
- Add a global
appearance.jsonconfig in the server state directory so users can change UI and terminal font family / size now, before a dedicated settings UI exists. - Bootstrap
appearance.jsonautomatically on first run so existing users and fresh installs do not hit startup errors when the file is missing. - Validate and watch the appearance config on the server, expose the resolved appearance through
server.getConfig, and push section-awareserver.configUpdatedevents on reload. - Apply the resolved appearance live in the web app through CSS variables and terminal updates so editing
appearance.jsonimmediately affects typography. - Convert the targeted fixed pixel text utilities to
remso UI font-size changes actually scale across the main surfaces. - Add settings-page visibility for the
appearance.jsonpath plus an open-in-editor action, so users can find and edit the config file easily. - Leave full in-app font controls for a later PR so the core T3 Code team can design that UI in the style they want.
Context#
This is aimed at a real usability problem on high-resolution monitors, especially QHD and above, where the default typography can read too small.
This PR intentionally solves that immediately with a user-editable config file. Users can change the font values now by editing appearance.json. A later PR can add a proper in-app settings UI for the same values.
Testing#
bun run test src/appearance.test.ts src/wsServer.test.tsinapps/serverbun run test src/appearance.test.ts src/wsNativeApi.test.tsinapps/webbun run test src/appearance.test.tsinpackages/contractsbun lintbun typecheck
Note
Add file‑backed appearance config and apply terminal font overrides across web and server components#
Introduce a server Appearance service with file‑backed appearance.json, broadcast config updates with changedSections and split issue arrays, load appearance in serverGetConfig, and wire the layer into runtime; on the web, add an in‑memory appearance store that applies CSS variables and a useResolvedAppearance hook, sync server appearance at app root, and update TerminalViewport to use appearance.monoFontFamily and appearance.terminalFontSizePx with a shared fitTerminalAndSyncSize util; convert fixed px font sizes to rem across UI. Key types and payloads in contracts are updated to include appearance and separate issue arrays. Core entry points: apps/server/src/appearance.ts, apps/server/src/wsServer.ts, packages/contracts/src/server.ts, and apps/web/src/appearance.ts.
📍Where to Start#
Start with the makeAppearance service and change stream in apps/server/src/appearance.ts, then review the WebSocket wiring in apps/server/src/wsServer.ts and the web runtime application in apps/web/src/appearance.ts.
- 1
- apps/web/src/components/ThreadTerminalDrawer.tsx line 414Resolvedby nassimna(GitHub profile, opens in a new tab)@@ -394,3 +396,4 @@394396 // eslint-disable-next-line react-hooks/exhaustive-deps395397 }, [cwd, runtimeEnv, terminalId, threadId]);396398399+ useEffect(() => {
🟠 High
components/ThreadTerminalDrawer.tsx:399The
useEffectat lines 399-406 updatesterminal.options.fontSizeand callsfitAddon.fit()when appearance changes, but does not notify the backend of the new terminal dimensions. This causes the backend PTY to retain stale dimensions while the frontend resizes, leading to mismatched line wrapping, visual corruption, and broken cursor positioning. Consider addingapi.terminal.resizewith the updatedcolsandrowsafterfitAddon.fit().🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/web/src/components/ThreadTerminalDrawer.tsx around line 399: The `useEffect` at lines 399-406 updates `terminal.options.fontSize` and calls `fitAddon.fit()` when appearance changes, but does not notify the backend of the new terminal dimensions. This causes the backend PTY to retain stale dimensions while the frontend resizes, leading to mismatched line wrapping, visual corruption, and broken cursor positioning. Consider adding `api.terminal.resize` with the updated `cols` and `rows` after `fitAddon.fit()`. Evidence trail: apps/web/src/components/ThreadTerminalDrawer.tsx lines 399-407 (appearance change useEffect with no api.terminal.resize call), lines 420-443 (drawer height/resizeEpoch useEffect that DOES call api.terminal.resize), lines 710 and 726 (only places setResizeEpoch is called - not triggered by appearance changes). t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
7435c118-cb95-48ac-9549-e5d742a303acYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share