Add global UI scale setting and zoom shortcuts (#3862)
Closes #3862
Summary
- Add app.uiScale as a clamped global UI scale loaded from and persisted to cmux.json
- Add customizable UI zoom shortcuts: Cmd+Shift+=, Cmd+Shift+-, Cmd+Shift+0
- Flow uiScaleFactor through SwiftUI environment and scale built-in chrome surfaces including sidebars, file browser, settings, markdown, and task manager
- Complete localization coverage for the new UI scale strings across all locales already present in Localizable.xcstrings
Testing
- Test-first commit added regression coverage before implementation
- Static diff check passed: git diff --check
- Localizable.xcstrings parsed as JSON and all 9 new UI scale keys were verified to include the expected 19-locale coverage
- Local test/build not run per repository/user policy; CI owns test execution
Demo Video
- Not applicable for this enhancement PR; no crash or visual bug reproduction video was required.
- Tagged dev app launch will be done after CI is green, per the branch handoff order.
[!NOTE]
Medium Risk
Touches cross-cutting UI layout/typography and introduces new settings-file persistence/editing logic, which could cause regressions in sizing, shortcut routing, or config writes if edge cases are missed.
Overview
Adds a new global UI scaling setting (app.uiScale) that is clamped, stored in UserDefaults, persisted to cmux.json, and injected via a uiScaleFactor SwiftUI environment value from the main window root.
Introduces configurable UI Zoom In/Out/Reset shortcuts and routes them through the app’s key-event handling (including AppKit key-equivalent fallbacks) while suppressing them when the command palette is effectively visible.
Applies UI scale throughout built-in chrome (sidebars, right sidebar controls, file explorer AppKit views, markdown web preview base font size, various headers/popovers) via scaled metrics/fonts, updates settings/search indexing to surface the new option, and adds full localization strings/aliases for the new UI scale and menu items.
Reviewed by Cursor Bugbot for commit 5da03c941bee5c8b2b76ec6c78d8a879d8519f9d. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds a global UI scale setting in cmux.json with app‑wide Zoom In/Out/Reset shortcuts. Scales built‑in chrome across the app independent of terminal font size or browser zoom (Linear 3862).
-
New Features
app.uiScale(default 1.0, clamp 0.7–2.0) with a slider and customizable shortcuts (Cmd+Shift+=/−/0).- App‑global
uiScaleFactorinjected from app roots and applied across SwiftUI/AppKit chrome: sidebars, file explorer (row height/indent/icons/header), right‑sidebar mode bar/controls, settings, markdown base font size, session index and transcript popovers, task manager, popovers, and the shortcut hint pill. - Schema/search updates and docs (
web/data/cmux.schema.json,web/data/cmux-shortcuts.ts); JSONC‑preserving settings editor; tests (UIScaleSettingsTests) cover cmux.json round‑trip, environment propagation, and clamp/reset via shortcuts.
-
Bug Fixes
- Keep zoom shortcuts app‑global, return handled status, and disable while the Command Palette is open.
- Safer persistence: JSONC‑preserving edits; debounced, serialized background writes that skip stale values; main‑thread reloads gated to newer values; “Reset all” uses the same path; do not overwrite externally managed UI‑scale changes; resolve Sendable warnings.
- Preserve file explorer expansion/selection and avoid redundant layout on scale changes.
- Align chrome sizing and typography: right‑sidebar metrics, session index and captions, transcript popovers/body fonts, unread badges, PR icon geometry, and popover loading text; Task Manager now hosts a UI‑scale root wrapper so live changes apply.
- Fix session popover tests by passing
uiScaleFactor.
Summary by CodeRabbit
-
New Features
- App-wide UI Scale: settings slider, persistent value, and global zoom shortcuts (Cmd+Shift+=, Cmd+Shift+-, Cmd+Shift+0).
-
UI Improvements
- UI scaling applied across sidebars, panels, file explorer, task manager, markdown, toolbars, and other chrome for consistent typography, iconography, and spacing.
-
Localization
- Updated English/Japanese strings and new localized entries/search aliases for UI scale and zoom shortcuts.
-
Tests
- Added tests for scale persistence, environment propagation, and shortcut behavior.