Allow cmux sidebar theming from Ghostty config

Closed
AU
2mo ago
+778-634

Closes #1759.

Summary

  • Add cmux-specific Ghostty config keys for sidebar background, selection, foreground, muted text, border, accent, and notification badge colors.
  • Apply those colors through the existing sidebar settings snapshot path so row rendering stays value-driven.
  • Track Ghostty-managed sidebar defaults so removing config keys clears only values cmux previously applied and leaves user-changed settings alone.
  • Document the new Ghostty sidebar keys in docs/configuration.md.

Scope

  • This PR covers color theming as the first self-contained increment. The issue comment requesting sidebar font-size theming is left for follow-up.

Verification

  • git diff --check
  • Local tests/builds not run per repository and task policy; CI is the source of truth.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


[!NOTE]
Medium Risk
Touches appearance persistence in UserDefaults and broad sidebar rendering paths; logic is heavily tested but wrong managed-key clearing could surprise users who mix manual and config-driven colors.

Overview
Adds Ghostty-driven sidebar color theming: new cmux-specific config keys (foreground, muted text, selection foreground, border, accent, notification badge, plus existing selection background) are parsed, resolved for light/dark pairs, and written into UserDefaults through an expanded applySidebarAppearanceToUserDefaults path that records prior writes under cmux.ghosttyConfig.sidebarAppearance.appliedValues.v1 so removing or changing config only clears values cmux still owns—not user-edited hex overrides.

The sidebar settings snapshot gains the new hex fields, and workspace rows use them for primary/muted text, selection foreground, active borders, progress tracks/fills, unread badges, drop indicators, and the trailing divider (via WindowChromeBorder color override). Accent and border fall back to existing cmux defaults when unset.

Docs (docs/configuration.md) document the keys; tests cover parsing, resolution, managed-default clearing, and invalid-config preservation.

Reviewed by Cursor Bugbot for commit bc511653cbd340e2398afac63a40e0577a97ccdb. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Adds Ghostty-driven theming for the cmux sidebar with light/dark support and preserved user overrides. Also bounds sidebar row text to fixed line limits to prevent layout overflow and fixes muted detail color. Addresses Linear #1759.

  • New Features

    • New Ghostty keys: sidebar-background, sidebar-tint-opacity, sidebar-selection-background, sidebar-selection-foreground, sidebar-foreground, sidebar-muted-foreground, sidebar-border-color, sidebar-accent-color, sidebar-notification-badge-background (alias: sidebar-notification-badge-color).
    • UI applies these to default/muted/selection text, borders (row + trailing divider via WindowChromeBorder override), progress track/fill, drop indicators, and badges; selection/muted text fall back to configured foreground when unset.
    • Settings snapshot now includes hex values for all sidebar theme colors. Docs and tests updated.
  • Bug Fixes

    • Preserves user-edited values by tracking Ghostty-managed writes in cmux.ghosttyConfig.sidebarAppearance.appliedValues.v1, and clears only keys cmux set (including opacity), including when config keys are removed or switch from paired to single/dark-only.
    • Applies muted sidebar detail color to secondary labels and info messages; improves fallbacks to avoid unreadable text and ensures progress contrast.
    • Bounds row title, description, and metadata blocks to max lines to avoid unbounded growth.

Summary by CodeRabbit

  • New Features

    • Added sidebar theme color customization via hex config (foreground, muted foreground, selection, border, and accent).
    • Sidebar accents and top drop indicator visuals now follow the configured theme, with improved active-state coloring.
    • Theme color support includes optional light/dark paired values for more precise styling.
  • Bug Fixes

    • Improved handling of managed sidebar theme defaults to preserve or clear values correctly when switching theme sources.
  • Documentation

    • Expanded the configuration guide to describe supported sidebar theme keys, including sidebar-notification-badge-color as an alias.