Repository navigation
Move tabs into new workspaces #3285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0c35782
Move tabs into new workspaces
lawrencecchen 55c0472
Merge remote-tracking branch 'origin/main' into feat-detach-tab-to-wo…
lawrencecchen acb898c
Add adjacent pane move regression tests
lawrencecchen aabf442
Fix moving tabs from Bonsplit menus and drops
lawrencecchen 24e7fa5
Merge remote-tracking branch 'origin/main' into feat-detach-tab-to-wo…
lawrencecchen c43dae8
Fix move tab socket focus behavior
lawrencecchen 0b8b8b8
Fix move tab file length budget
lawrencecchen f1118b6
Fix move tab CI feedback
lawrencecchen fb5f3f4
Merge origin/main into feat-detach-tab-to-workspace
lawrencecchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import Foundation | ||
|
|
||
| extension CMUXCLI { | ||
| func applyTabActionFocusOption(_ focusOpt: String?, to params: inout [String: Any]) throws { | ||
| guard let focusOpt else { return } | ||
| guard let focus = parseBoolString(focusOpt) else { | ||
| throw CLIError(message: "--focus must be true|false") | ||
| } | ||
| params["focus"] = focus | ||
| } | ||
|
|
||
| func appendCreatedWorkspaceSummaryParts( | ||
| from payload: [String: Any], | ||
| idFormat: CLIIDFormat, | ||
| to summaryParts: inout [String] | ||
| ) { | ||
| guard let id = payload["created_workspace_id"] as? String else { return } | ||
| var createdWorkspacePayload: [String: Any] = ["workspace_id": id] | ||
| if let ref = payload["created_workspace_ref"] as? String { | ||
| createdWorkspacePayload["workspace_ref"] = ref | ||
| } | ||
| if let createdWorkspace = formatHandle(createdWorkspacePayload, kind: "workspace", idFormat: idFormat) { | ||
| summaryParts.append("created_workspace=\(createdWorkspace)") | ||
| } | ||
| } | ||
|
|
||
| func runMoveTabToNewWorkspace( | ||
| commandArgs: [String], | ||
| client: SocketClient, | ||
| jsonOutput: Bool, | ||
| idFormat: CLIIDFormat, | ||
| windowOverride: String? | ||
| ) throws { | ||
| if commandArgs.contains(where: { $0 == "--action" || $0.hasPrefix("--action=") }) { | ||
| throw CLIError(message: "move-tab-to-new-workspace does not accept --action") | ||
| } | ||
| try runTabAction( | ||
| commandArgs: ["--action", "move-to-new-workspace"] + commandArgs, | ||
| client: client, | ||
| jsonOutput: jsonOutput, | ||
| idFormat: idFormat, | ||
| windowOverride: windowOverride | ||
| ) | ||
| } | ||
|
|
||
| static let moveTabToNewWorkspaceCommandHelp = """ | ||
| Usage: cmux move-tab-to-new-workspace [--tab <id|ref|index>] [--surface <id|ref|index>] [--workspace <id|ref|index>] [--title <text>] [--focus <true|false>] | ||
|
|
||
| Move a tab into a newly created workspace in the same window. | ||
|
|
||
| Flags: | ||
| --tab <id|ref|index> Target tab (accepts tab:<n> or surface:<n>; default: $CMUX_TAB_ID, then $CMUX_SURFACE_ID, then focused tab) | ||
| --surface <id|ref|index> Alias for --tab | ||
| --workspace <id|ref|index> Workspace context (default: current/$CMUX_WORKSPACE_ID) | ||
| --title <text> Optional title for the new workspace | ||
| --focus <true|false> Focus the new workspace when supported (default: false) | ||
|
|
||
| Example: | ||
| cmux move-tab-to-new-workspace --tab tab:2 | ||
| cmux move-tab-to-new-workspace --surface surface:3 --title "build logs" | ||
| """ | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set a non-focus default when
--focusis omitted for move-to-new-workspace.Line 4636 only applies
focuswhen provided. Fortab.action move-to-new-workspace, this means nofocuskey is sent, and the server path defaults totrue, which can steal in-app focus unexpectedly.Suggested fix
Based on learnings: "Socket/CLI commands must not steal macOS app focus ... only explicit focus-intent commands may mutate in-app focus/selection ... all non-focus commands should preserve current user focus context."
📝 Committable suggestion
🤖 Prompt for AI Agents