Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 3 additions & 3 deletions .github/swift-file-length-budget.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
20530 CLI/cmux.swift
17229 Sources/TerminalController.swift
16020 Sources/ContentView.swift
14471 Sources/AppDelegate.swift
14475 Sources/AppDelegate.swift
13932 Sources/Workspace.swift
13409 Sources/GhosttyTerminalView.swift
10597 Sources/Panels/BrowserPanel.swift
Expand All @@ -21,7 +21,7 @@
3840 Sources/Feed/FeedPanelView.swift
3588 cmuxTests/BrowserConfigTests.swift
3145 cmuxTests/BrowserPanelTests.swift
2922 Sources/CmuxConfig.swift
2938 Sources/CmuxConfig.swift
2863 cmuxTests/WindowAndDragTests.swift
2609 Sources/SessionIndexView.swift
2491 Sources/Panels/CmuxWebView.swift
Expand All @@ -33,7 +33,7 @@
2026 cmuxTests/CJKIMEInputTests.swift
1949 Sources/Panels/BrowserWebAuthnSupport.swift
1879 Sources/FileExplorerView.swift
1846 cmuxTests/CmuxConfigTests.swift
1899 cmuxTests/CmuxConfigTests.swift
1826 Sources/SessionIndexStore.swift
1784 cmuxTests/ShortcutAndCommandPaletteTests.swift
1684 Sources/KeyboardShortcutSettingsFileStore.swift
Expand Down
12 changes: 12 additions & 0 deletions GhosttyTabs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
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 */; };
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 +377,7 @@
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>"; };
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 +407,8 @@
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>"; };
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 +784,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 @@ -999,6 +1007,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 +1267,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 @@ -1514,6 +1525,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