Repository navigation
Allow narrower sidebar widths via configurable minimum - #6875
austinywang wants to merge 11 commits into
Conversation
The left (workspace) sidebar could not be dragged narrower than the hard-coded 216pt floor in SessionPersistencePolicy, and there was no config key to override it (issue #6784). Nearly half the sidebar is dead space at that width. Expose the floor as a first-class setting, mirroring the existing `RightSidebarWidthSettings` pattern: - Add `LeftSidebarWidthSettings` policy in CmuxSettings as the single source of truth: cmux.json key `sidebar.leftMinWidth`, UserDefaults key `sidebarMinimumWidth` (unchanged, back-compatible), default 216, configurable range 100...260 (lowered floor from 120 so users can reclaim ~half the sidebar), and a clamp helper. - `SessionPersistencePolicy` now delegates its min-width constants and sanitizer to that policy so the runtime, catalog, cmux.json loader, and Settings UI all agree. Default/minimum stay 216; behavior for existing users is unchanged. - Load `sidebar.leftMinWidth` from cmux.json (clamped) and register it in the supported settings-path set. - Add a "Sidebar Minimum Width" slider row to the Sidebar settings section plus a curated search entry, localized (en/ja). - Document the key in cmux.schema.json and the configuration docs. Tests: policy clamp + identifiers (CmuxSettings), cmux.json apply/clamp + ContentView drag-clamp + range parity (cmuxTests), and the new row's search anchor resolution (CmuxSettingsUI). Fixes #6784 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a configurable left sidebar minimum width setting across settings storage, persistence, cmux.json parsing, UI, schema, localization, and tests. Also migrates sidebar width tests to Swift Testing and includes unrelated iOS and localization ordering edits. ChangesLeft Sidebar Minimum Width Feature
Unrelated Minor Edits
Estimated code review effort: 3 (Moderate) | ~30 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 2 warnings)
✅ Passed checks (22 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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. Comment |
Greptile SummaryThis PR makes the left (workspace) sidebar's minimum resize width configurable via a new
Confidence Score: 5/5Safe to merge — the change is backward-compatible, default behavior is unchanged, and new configuration paths are fully tested. The new LeftSidebarWidthSettings type is a pure value type with no mutable state; it cleanly replaces inline literals in SessionPersistencePolicy without altering any existing call sites. The configurable floor is correctly threaded through resolvedMinimumSidebarWidth → ContentView.clampedSidebarWidth via an explicit parameter, so the static minimumSidebarWidth = 216 fallback remains correct. Localization covers all app and web locales. The json-path guard, clamp, and schema are consistent with the existing rightMaxWidth pattern. No actor isolation, blocking, or state management concerns introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["cmux.json\nsidebar.leftMinWidth: 120"] --> B["CmuxSettingsFileStore\nparseSidebarSection"]
B --> C{"value > 0?"}
C -- Yes --> D["LeftSidebarWidthSettings().clampedMinimumWidth(value)\n→ clamped to 100–260"]
C -- No --> E["logInvalid(settingsPath)"]
D --> F["UserDefaults\nsidebarMinimumWidth = 120"]
G["Settings UI Slider\n100–260 pt"] --> H["leftMinWidthBinding.set(clampedValue)"]
H --> F
F --> I["SessionPersistencePolicy\n.resolvedMinimumSidebarWidth(defaults:)"]
I --> J["ContentView.clampedSidebarWidth\n(width, max: 600, min: resolved)"]
J --> K["Sidebar renders at\nconfigured minimum floor"]
L["LeftSidebarWidthSettings\ndefault=216, range=100…260"] --> B
L --> G
L --> I
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["cmux.json\nsidebar.leftMinWidth: 120"] --> B["CmuxSettingsFileStore\nparseSidebarSection"]
B --> C{"value > 0?"}
C -- Yes --> D["LeftSidebarWidthSettings().clampedMinimumWidth(value)\n→ clamped to 100–260"]
C -- No --> E["logInvalid(settingsPath)"]
D --> F["UserDefaults\nsidebarMinimumWidth = 120"]
G["Settings UI Slider\n100–260 pt"] --> H["leftMinWidthBinding.set(clampedValue)"]
H --> F
F --> I["SessionPersistencePolicy\n.resolvedMinimumSidebarWidth(defaults:)"]
I --> J["ContentView.clampedSidebarWidth\n(width, max: 600, min: resolved)"]
J --> K["Sidebar renders at\nconfigured minimum floor"]
L["LeftSidebarWidthSettings\ndefault=216, range=100…260"] --> B
L --> G
L --> I
Reviews (11): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
This comment has been minimized.
This comment has been minimized.
- Regenerate .github/swift-file-length-budget.tsv to account for the new SidebarSection row, test additions, and the small parser/policy growth (via scripts/swift_file_length_budget.py --write-budget). - Make the cmux.json `sidebar.leftMinWidth` schema use `exclusiveMinimum: 0` to match the loader's `value > 0` guard (mirrors `rightMaxWidth`), so a schema-aware editor and the runtime agree. Out-of-range values are still clamped to 100–260 as documented in the description (Greptile feedback). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks @greptile-apps — fixed the schema/parser inconsistency in 8083bc8. The |
|
Thanks for the follow-up — that's the right fix. Using |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Prior synchronize events for the budget/schema/docs fixes did not create ci.yml runs (GitHub Actions dropped them under heavy fleet load). Empty commit to force a fresh run on the fixed HEAD. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ower-sidebar-widths # Conflicts: # .github/swift-file-length-budget.tsv
Greptile flagged that schemaDescriptions.sidebar.leftMinWidth was only in en/ja while the sibling rightMaxWidth is translated across all 20 supported web-docs locales. Add proper translations for the remaining 18 locales (ar, bs, da, de, es, fr, it, km, ko, no, pl, pt-BR, ru, th, tr, uk, zh-CN, zh-TW) matching each locale's existing rightMaxWidth terminology. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Addressed the web-docs locale gap in 5d77983: |
…ower-sidebar-widths # Conflicts: # .github/swift-file-length-budget.tsv # Resources/Localizable.xcstrings
…ower-sidebar-widths
…ower-sidebar-widths
|
CodeRabbit pre-merge note on |
|
@austinywang wondering if the PR will be merged, it's a much needed feature! |
|
Thanks for this, Austin. Your approach is carried forward in #14875 (rebased on current main, with you as co-author), so I'm closing this one in favor of it. |
Fixes #6784
Problem
The left (workspace) sidebar couldn't be dragged narrower than the hard-coded 216pt floor (
minimumSidebarWidthinSources/SessionPersistence.swift), and there was no config key to override it. As the reporter notes, nearly half the sidebar is dead space at that width.Solution
Expose the minimum as a first-class setting, mirroring the existing
RightSidebarWidthSettings("Dock Max Width") pattern so all layers share one source of truth.LeftSidebarWidthSettings(inCmuxSettings): cmux.json keysidebar.leftMinWidth, UserDefaults keysidebarMinimumWidth(unchanged → back-compatible), default 216, configurable range 100…260 (floor lowered from 120 so users can reclaim ~half the sidebar), plus a clamp helper.SessionPersistencePolicynow delegates its min-width constants + sanitizer to that policy. Default/minimum stay 216 → existing users see no change; only the configurable floor moved.sidebar.leftMinWidthis parsed (clamped) by the settings file store and added to the supported-paths set.web/data/cmux.schema.jsonand the configuration docs (en.json/ja.json).How to use
…or drag the Settings → Sidebar → Sidebar Minimum Width slider. The sidebar can then be dragged down to the configured floor (clamped 100–260).
Tests
LeftSidebarWidthSettingsclamp + identifiers (CmuxSettings package).resolvedMinimumSidebarWidth,ContentView.clampedSidebarWidthdrag-floor, and range/key parity (cmuxTests/SidebarWidthPolicyTests.swift).CmuxSettingsUI).Default behavior is unchanged (216 default/minimum preserved; all existing width tests still pass).
🤖 Generated with Claude Code
Summary by cubic
Make the left (workspace) sidebar’s minimum width configurable so users can drag it narrower (100–260 pt). Default stays 216 pt; set via
sidebar.leftMinWidthincmux.jsonor a Settings slider. Addresses #6784.New Features
LeftSidebarWidthSettings(source of truth): keysidebar.leftMinWidth,UserDefaultssidebarMinimumWidth, 100–260 pt range (default 216), clamp helper.SessionPersistencePolicynow uses this policy; the drag floor respects the configured value.cmux.json.cmux.jsonapply/clamp, drag‑floor behavior, and settings anchor resolution; sidebar width tests migrated to Swift Testing.Bug Fixes
web/data/cmux.schema.jsonusesexclusiveMinimum: 0to match the loader; docs translated across all web locales..github/swift-file-length-budget.tsvfor the new settings row and tests.Written for commit bfc1edb. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation & Localization
sidebar.leftMinWidthsetting across supported languages.Tests