Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/swift-file-length-budget.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Reduce counts as files shrink. CI fails if tracked files exceed this budget.
20530 CLI/cmux.swift
17229 Sources/TerminalController.swift
16048 Sources/ContentView.swift
16020 Sources/ContentView.swift
14475 Sources/AppDelegate.swift
13932 Sources/Workspace.swift
13409 Sources/GhosttyTerminalView.swift
Expand Down
20 changes: 20 additions & 0 deletions GhosttyTabs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
D0B1000CA1B2C3D4E5F60001 /* CmuxWebViewDragRoutingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B1000DA1B2C3D4E5F60001 /* CmuxWebViewDragRoutingTests.swift */; };
D0B1000EA1B2C3D4E5F60001 /* BrowserPaneDropRoutingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B1000FA1B2C3D4E5F60001 /* BrowserPaneDropRoutingTests.swift */; };
D0B10010A1B2C3D4E5F60001 /* BonsplitTabBarDebug.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B10011A1B2C3D4E5F60001 /* BonsplitTabBarDebug.swift */; };
D7AB34300000000000000001 /* SidebarDropPlanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB34300000000000000002 /* SidebarDropPlanner.swift */; };
D7AB34300000000000000003 /* SidebarBonsplitTabWorkspaceDropOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB34300000000000000004 /* SidebarBonsplitTabWorkspaceDropOverlay.swift */; };
D7AB34300000000000000005 /* SidebarWorkspaceDropPlannerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB34300000000000000006 /* SidebarWorkspaceDropPlannerTests.swift */; };
D7AB34400000000000000001 /* WorkspaceSurfaceConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB34400000000000000002 /* WorkspaceSurfaceConfig.swift */; };
D7AB34400000000000000003 /* GhosttyTerminalViewVisibilityPolicyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB34400000000000000004 /* GhosttyTerminalViewVisibilityPolicyTests.swift */; };
5EDB6027B346C46521A93C74 /* CMUXAuthCore in Frameworks */ = {isa = PBXBuildFile; productRef = 29813FE5A6CBC1019289A251 /* CMUXAuthCore */; };
AA11BB22CC33DD44EE550001 /* CMUXWorkstream in Frameworks */ = {isa = PBXBuildFile; productRef = AA11BB22CC33DD44EE550002 /* CMUXWorkstream */; };
FEED0000000000000000F002 /* FeedCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEED0000000000000000F001 /* FeedCoordinator.swift */; };
Expand Down Expand Up @@ -374,6 +379,8 @@
43430FA5929121E2EAAB3091 /* AuthEnvironment.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AuthEnvironment.swift; sourceTree = "<group>"; };
491751CE2321474474F27DCF /* TerminalControllerSocketSecurityTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalControllerSocketSecurityTests.swift; sourceTree = "<group>"; };
51D800000000000000000002 /* SidebarIdentifierFormattingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarIdentifierFormattingTests.swift; sourceTree = "<group>"; };
D7AB34300000000000000006 /* SidebarWorkspaceDropPlannerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarWorkspaceDropPlannerTests.swift; sourceTree = "<group>"; };
D7AB34400000000000000004 /* GhosttyTerminalViewVisibilityPolicyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyTerminalViewVisibilityPolicyTests.swift; sourceTree = "<group>"; };
9C1BEA3D2E6F49709A71C021 /* TerminalControllerSocketWriteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalControllerSocketWriteTests.swift; sourceTree = "<group>"; };
58C7B1B978620BE162CC057E /* BrowserPanelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserPanelTests.swift; sourceTree = "<group>"; };
5B1EA8948C5F126FE63CFB4E /* AuthSettingsStore.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AuthSettingsStore.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -403,6 +410,9 @@
A5001012 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
C3408A000000000000000002 /* ContentView+RightSidebarCommandPalette.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ContentView+RightSidebarCommandPalette.swift"; sourceTree = "<group>"; };
D7AB00000000000000000004 /* ContentView+MoveTabToNewWorkspace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ContentView+MoveTabToNewWorkspace.swift"; sourceTree = "<group>"; };
D7AB34300000000000000002 /* SidebarDropPlanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarDropPlanner.swift; sourceTree = "<group>"; };
D7AB34300000000000000004 /* SidebarBonsplitTabWorkspaceDropOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarBonsplitTabWorkspaceDropOverlay.swift; sourceTree = "<group>"; };
D7AB34400000000000000002 /* WorkspaceSurfaceConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceSurfaceConfig.swift; sourceTree = "<group>"; };
D0C0D0C0D0C0D0C0D0C0D002 /* DockPanelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DockPanelView.swift; sourceTree = "<group>"; };
D0C0D0C0D0C0D0C0D0C0D004 /* DockEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DockEmptyView.swift; sourceTree = "<group>"; };
C0DE32470000000000000002 /* ContentViewIdentifierCopyCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentViewIdentifierCopyCommands.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -778,6 +788,8 @@
A5001012 /* ContentView.swift */,
C3408A000000000000000002 /* ContentView+RightSidebarCommandPalette.swift */,
D7AB00000000000000000004 /* ContentView+MoveTabToNewWorkspace.swift */,
D7AB34300000000000000002 /* SidebarDropPlanner.swift */,
D7AB34300000000000000004 /* SidebarBonsplitTabWorkspaceDropOverlay.swift */,
C0DE32470000000000000002 /* ContentViewIdentifierCopyCommands.swift */,
9960CC3992F3C44489E7627C /* WorkspaceRuntimeSettings.swift */,
243632BA1DBBA36FD46E0610 /* SidebarAppearanceSupport.swift */,
Expand Down Expand Up @@ -814,6 +826,7 @@
A5001520 /* PostHogAnalytics.swift */,
A5001416 /* Workspace.swift */,
D7AB00000000000000000016 /* Workspace+DetachedSurfaceTransfer.swift */,
D7AB34400000000000000002 /* WorkspaceSurfaceConfig.swift */,
1A1B2C3D4E5F607180000002 /* WorkspacePromptSubmit.swift */,
D0B10005A1B2C3D4E5F60001 /* WorkspacePortalPaneDrop.swift */,
C0DE32470000000000000004 /* WorkspaceSurfaceIdentifierClipboardText.swift */,
Expand Down Expand Up @@ -976,6 +989,7 @@
D0B1000DA1B2C3D4E5F60001 /* CmuxWebViewDragRoutingTests.swift */,
D0B1000FA1B2C3D4E5F60001 /* BrowserPaneDropRoutingTests.swift */,
02FC74F2C27127CC565B3E8C /* TerminalAndGhosttyTests.swift */,
D7AB34400000000000000004 /* GhosttyTerminalViewVisibilityPolicyTests.swift */,
D7AB00000000000000000012 /* WorkspaceAdjacentPaneMoveTests.swift */,
D0B10009A1B2C3D4E5F60001 /* PortalTabDragRoutingTests.swift */,
71F8ED91A4B55D34BE6A0668 /* WorkspaceUnitTests.swift */,
Expand All @@ -999,6 +1013,7 @@
1D301919B10F22B8708E8883 /* WorkspaceManualUnreadTests.swift */,
EE0171AF1F49F7547191CEE5 /* SidebarWidthPolicyTests.swift */,
51D800000000000000000002 /* SidebarIdentifierFormattingTests.swift */,
D7AB34300000000000000006 /* SidebarWorkspaceDropPlannerTests.swift */,
491751CE2321474474F27DCF /* TerminalControllerSocketSecurityTests.swift */,
9C1BEA3D2E6F49709A71C021 /* TerminalControllerSocketWriteTests.swift */,
A5A5A504A1B2C3D4E5F60718 /* TerminalNotificationQueueTests.swift */,
Expand Down Expand Up @@ -1258,6 +1273,8 @@
A5001002 /* ContentView.swift in Sources */,
C3408A000000000000000001 /* ContentView+RightSidebarCommandPalette.swift in Sources */,
D7AB00000000000000000003 /* ContentView+MoveTabToNewWorkspace.swift in Sources */,
D7AB34300000000000000001 /* SidebarDropPlanner.swift in Sources */,
D7AB34300000000000000003 /* SidebarBonsplitTabWorkspaceDropOverlay.swift in Sources */,
C0DE32470000000000000001 /* ContentViewIdentifierCopyCommands.swift in Sources */,
619D509BC9B1EA946CBD6A8A /* WorkspaceRuntimeSettings.swift in Sources */,
211A75777F433ED8BA5AE208 /* SidebarAppearanceSupport.swift in Sources */,
Expand Down Expand Up @@ -1294,6 +1311,7 @@
A5001521 /* PostHogAnalytics.swift in Sources */,
A5001406 /* Workspace.swift in Sources */,
D7AB00000000000000000015 /* Workspace+DetachedSurfaceTransfer.swift in Sources */,
D7AB34400000000000000001 /* WorkspaceSurfaceConfig.swift in Sources */,
1A1B2C3D4E5F607180000001 /* WorkspacePromptSubmit.swift in Sources */,
D0B10004A1B2C3D4E5F60001 /* WorkspacePortalPaneDrop.swift in Sources */,
C0DE32470000000000000003 /* WorkspaceSurfaceIdentifierClipboardText.swift in Sources */,
Expand Down Expand Up @@ -1490,6 +1508,7 @@
D0B1000CA1B2C3D4E5F60001 /* CmuxWebViewDragRoutingTests.swift in Sources */,
D0B1000EA1B2C3D4E5F60001 /* BrowserPaneDropRoutingTests.swift in Sources */,
46F6AC15863EC84DCD3770A2 /* TerminalAndGhosttyTests.swift in Sources */,
D7AB34400000000000000003 /* GhosttyTerminalViewVisibilityPolicyTests.swift in Sources */,
D7AB00000000000000000011 /* WorkspaceAdjacentPaneMoveTests.swift in Sources */,
D0B10008A1B2C3D4E5F60001 /* PortalTabDragRoutingTests.swift in Sources */,
6B524A0BA34FD46A771335AB /* WorkspaceUnitTests.swift in Sources */,
Expand All @@ -1514,6 +1533,7 @@
0F2C25F9170130F8DC09DD1B /* WorkspaceManualUnreadTests.swift in Sources */,
CA39C0304FE351A21C372429 /* SidebarWidthPolicyTests.swift in Sources */,
51D800000000000000000001 /* SidebarIdentifierFormattingTests.swift in Sources */,
D7AB34300000000000000005 /* SidebarWorkspaceDropPlannerTests.swift in Sources */,
8C4BBF2DEF6DF93F395A9EE7 /* TerminalControllerSocketSecurityTests.swift in Sources */,
9C1BEA3D2E6F49709A71C020 /* TerminalControllerSocketWriteTests.swift in Sources */,
A5A5A503A1B2C3D4E5F60718 /* TerminalNotificationQueueTests.swift in Sources */,
Expand Down
21 changes: 18 additions & 3 deletions Sources/AppDelegate+MoveTabToNewWorkspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,26 @@ extension AppDelegate {
return canMoveSurfaceToNewWorkspace(panelId: located.panelId)
}

func canMoveBonsplitTab(tabId: UUID, toWorkspace targetWorkspaceId: UUID) -> Bool {
guard let located = locateBonsplitSurface(tabId: tabId),
let sourceWorkspace = located.tabManager.tabs.first(where: { $0.id == located.workspaceId }),
sourceWorkspace.panels[located.panelId] != nil,
let destinationManager = tabManagerFor(tabId: targetWorkspaceId),
destinationManager.tabs.contains(where: { $0.id == targetWorkspaceId }) else {
return false
}
return true
}

@discardableResult
func moveBonsplitTabToNewWorkspace(
tabId: UUID,
destinationManager: TabManager? = nil,
title: String? = nil,
focus: Bool = true,
focusWindow: Bool = true,
placementOverride: NewWorkspacePlacement? = nil
placementOverride: NewWorkspacePlacement? = nil,
insertionIndexOverride: Int? = nil
) -> SurfaceNewWorkspaceMoveResult? {
guard let located = locateBonsplitSurface(tabId: tabId) else { return nil }
return moveSurfaceToNewWorkspace(
Expand All @@ -41,7 +53,8 @@ extension AppDelegate {
title: title,
focus: focus,
focusWindow: focusWindow,
placementOverride: placementOverride
placementOverride: placementOverride,
insertionIndexOverride: insertionIndexOverride
)
}

Expand All @@ -52,7 +65,8 @@ extension AppDelegate {
title: String? = nil,
focus: Bool = true,
focusWindow: Bool = true,
placementOverride: NewWorkspacePlacement? = nil
placementOverride: NewWorkspacePlacement? = nil,
insertionIndexOverride: Int? = nil
) -> SurfaceNewWorkspaceMoveResult? {
guard let source = locateSurface(surfaceId: panelId),
let sourceWorkspace = source.tabManager.tabs.first(where: { $0.id == source.workspaceId }),
Expand All @@ -78,6 +92,7 @@ extension AppDelegate {
title: destinationTitle,
select: false,
placementOverride: placementOverride,
insertionIndexOverride: insertionIndexOverride,
focusIntent: activationIntent
) else {
rollbackDetachedSurface(
Expand Down
Loading