Preserve selected tabs in saved workspace layouts - #9527
austinywang wants to merge 8 commits into
Conversation
📝 WalkthroughWalkthroughCustom layouts now capture the selected tab in each pane and restore that selection when surfaces are populated. The ChangesSelected tab layout preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant LayoutCapture
participant CustomLayout
participant Bonsplit
LayoutCapture->>CustomLayout: record selected surface
CustomLayout->>Bonsplit: create or configure surfaces
Bonsplit-->>CustomLayout: return panel IDs
CustomLayout->>Bonsplit: select panels marked selected
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmuxTests/WorkspaceCustomLayoutOrderTests.swift`:
- Around line 94-147: Expand capturedLayoutRestoresSelectedTabInBackgroundPane
to cover a hand-written layout with the first surface marked selected and a
layout produced by captureConfigActionSnapshot(). After applying global focus,
assert that every pane restores its configured selected tab, including index 0
and the existing index 1 case.
In `@Sources/CmuxConfig.swift`:
- Line 1617: Add the optional boolean selected property to the surfaces item
definition in cmux.schema.json, matching the selected field decoded by
CmuxSurfaceDefinition and preserving existing schema validation behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 20468d70-e32b-4270-8bce-92dbe3b56032
📒 Files selected for processing (8)
Sources/CmuxConfig.swiftSources/Workspace+CustomLayout.swiftSources/Workspace+LayoutCapture.swiftSources/WorkspaceConfigActionCapture.swiftcmuxTests/WorkspaceCustomLayoutOrderTests.swiftweb/app/[locale]/(landing)/docs/custom-commands/page.tsxweb/messages/en.jsonweb/messages/ja.json
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Summary
CmuxSurfaceDefinitionwith an optionalselectedflag while keeping existing layouts backward compatiblecmux.jsonfield in English and JapaneseFixes #7444
Testing
cefc07ea17: on a Tailscale fleet Mac,xcodebuild ... -only-testing:cmuxTests/WorkspaceCustomLayoutOrderTests test-without-buildingfailed onlycapturedLayoutRestoresSelectedTabInBackgroundPane; the restored title wasBackground Ainstead ofBackground B.1ecd3693e7: the same fleet suite passed all 4 tests, includingcapturedLayoutRestoresSelectedTabInBackgroundPane../scripts/reload-cloud.sh --tag sym7444succeeded onblacksmith-6vcpu-macos-26: https://github.com/manaflow-ai/cmux/actions/runs/30882576258 (cloud path used; no local-build fallback)./tmp/cmux-debug-sym7444.sock: created a split workspace with tabs A/B in a background pane, selected B, refocused the other pane, then ranlayout save,layout get, andlayout open. The saved JSON marked B asselected: true; the reopened live tree selected B in the background pane and retained the other pane’s global focus. Deleted the temporary layout and terminated the tagged app afterward.surfaceSelectedkeys inweb/messages/en.jsonandweb/messages/ja.json, and checked the changed docs/Swift diff for new unlocalized UI text.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Preserves per-pane selected tabs in saved, handwritten, and config-action layouts so reopened workspaces keep the right tab in each pane. Adds
selectedtoCmuxSurfaceDefinitionand applies tab selection without activation, then restores focus, fixing #7444.New Features
selectedin saved-layout and config-action paths; select the marked tab in each pane when applying layouts.selectedincmux.jsonand localized the help text across all locales.Bug Fixes
selected(nofocus), preventing focus theft.Written for commit 0532b92. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation
Tests