From 5441ef32c809a92d1f01097f0d17506d86e59c22 Mon Sep 17 00:00:00 2001 From: Matheus Cavallini Date: Wed, 23 Sep 2026 15:13:04 -0300 Subject: [PATCH 1/2] fix(sidebar): expose focusable surface id for remote tmux tabs Custom sidebar tabs for an ssh-tmux workspace carried the mirror container's tab id as surfaceId, which surface.focus rejects. Report the container's active projected pane surface instead, so clicking a tmux window tab in a custom sidebar focuses it. Refs #14027 Co-Authored-By: Claude Opus 5.5 --- Sources/Workspace+CustomSidebarSnapshot.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/Workspace+CustomSidebarSnapshot.swift b/Sources/Workspace+CustomSidebarSnapshot.swift index cc5265b9b942..2b2298306839 100644 --- a/Sources/Workspace+CustomSidebarSnapshot.swift +++ b/Sources/Workspace+CustomSidebarSnapshot.swift @@ -134,10 +134,15 @@ extension Workspace { for tab in bonsplitController.tabs(inPane: paneId) { guard let panelId = panelIdFromSurfaceId(tab.id) else { continue } let git = reportedPanelGitBranch(panelId: panelId) + // A remote tmux window tab is a mirror container that + // `surface.focus` rejects; hand out its projected pane instead. + let focusSurfaceId = activeRemoteTmuxControlSurfaceProjection( + containerPanelID: panelId + )?.surfaceID ?? tab.id.uuid surfaces.append( CustomSidebarSurfaceSnapshot( panelId: panelId, - surfaceId: tab.id.uuid, + surfaceId: focusSurfaceId, title: tab.title, isFocused: panelId == focusedPanelId, isPinned: pinnedPanelIds.contains(panelId), From ac030f24f9b116769bbd77ce440fc47b0a00cdaa Mon Sep 17 00:00:00 2001 From: Matheus Cavallini Date: Wed, 23 Sep 2026 15:22:07 -0300 Subject: [PATCH 2/2] test(sidebar): cover focusable surface id for remote tmux tabs Co-Authored-By: Claude Opus 5.5 --- .../RemoteTmuxMirrorLayoutIdentityTests.swift | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cmuxTests/RemoteTmuxMirrorLayoutIdentityTests.swift b/cmuxTests/RemoteTmuxMirrorLayoutIdentityTests.swift index 88f25b176d1c..c08dc3455152 100644 --- a/cmuxTests/RemoteTmuxMirrorLayoutIdentityTests.swift +++ b/cmuxTests/RemoteTmuxMirrorLayoutIdentityTests.swift @@ -335,6 +335,32 @@ import Testing } } +extension RemoteTmuxMirrorLayoutIdentityTests { + @Test("custom sidebar tabs of a remote tmux window expose the focusable projected surface") + func customSidebarTabsExposeProjectedSurface() throws { + let harness = try Harness() + defer { harness.tearDown() } + + let projectedPanel = try #require(harness.singlePanePanel(tmuxPaneID: 11)) + let snapshot = harness.workspace.customSidebarWorkspaceSnapshot( + index: 0, + selectedId: harness.workspace.id, + unreadCount: 0 + ) + let tab = try #require(snapshot.surfaces.first { + harness.workspace.isRemoteTmuxControlContainer($0.panelId) + }) + let surfaceId = try #require(tab.surfaceId) + + #expect(surfaceId == projectedPanel.id) + #expect(tab.panelId != projectedPanel.id) + guard case .pane = harness.workspace.remoteTmuxControlSurfaceTarget(surfaceID: surfaceId) else { + Issue.record("sidebar surfaceId must resolve to a projected tmux pane") + return + } + } +} + private typealias Harness = RemoteTmuxSessionMirrorLayoutHarness @MainActor