From 79effca35f53a8db896bf3c02a49d2577b778b56 Mon Sep 17 00:00:00 2001 From: Ignas Date: Fri, 29 May 2026 23:30:55 +0300 Subject: [PATCH] fix: keep main windows movable for Swish --- Sources/App/CmuxMainWindow.swift | 7 ++++++- cmuxTests/WindowAndDragTests.swift | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Sources/App/CmuxMainWindow.swift b/Sources/App/CmuxMainWindow.swift index 4b1d2ea228..ae6489dedf 100644 --- a/Sources/App/CmuxMainWindow.swift +++ b/Sources/App/CmuxMainWindow.swift @@ -30,8 +30,13 @@ final class MainWindowHostingView: NSHostingView { @MainActor func configureCmuxMainWindowDragBehavior(_ window: NSWindow) { + // Keep the window movable so macOS Accessibility-based window managers + // (notably Swish) can identify cmux as a normal movable window and attach + // titlebar gestures. Content/background drags are still opt-in: cmux only + // starts AppKit window drags from explicit titlebar drag handles, and tab / + // folder drag interactions temporarily suppress movability while active. window.isMovableByWindowBackground = false - window.isMovable = false + window.isMovable = true } @MainActor diff --git a/cmuxTests/WindowAndDragTests.swift b/cmuxTests/WindowAndDragTests.swift index 50100e52ac..5da4972940 100644 --- a/cmuxTests/WindowAndDragTests.swift +++ b/cmuxTests/WindowAndDragTests.swift @@ -1862,7 +1862,7 @@ final class TitlebarLeadingInsetPassthroughViewTests: XCTestCase { ) } - func testMainWindowDragBehaviorRequiresExplicitDragZones() { + func testMainWindowDragBehaviorKeepsWindowManagerCompatibility() { let window = CmuxMainWindow( contentRect: NSRect(x: 0, y: 0, width: 320, height: 180), styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], @@ -1870,25 +1870,28 @@ final class TitlebarLeadingInsetPassthroughViewTests: XCTestCase { defer: false ) defer { window.orderOut(nil) } - window.isMovable = true + window.isMovable = false window.isMovableByWindowBackground = true configureCmuxMainWindowDragBehavior(window) - XCTAssertFalse( + XCTAssertTrue( window.isMovable, - "Main windows must not use native AppKit titlebar dragging because pane tabs live in the titlebar band" + "Main windows must remain movable so Accessibility-based window managers such as Swish can attach titlebar gestures" + ) + XCTAssertFalse( + window.isMovableByWindowBackground, + "Main content must not become an implicit AppKit background-drag region; explicit titlebar chrome owns app-window dragging" ) - XCTAssertFalse(window.isMovableByWindowBackground) let previous = withTemporaryWindowMovableEnabled(window: window) { XCTAssertTrue(window.isMovable) } - XCTAssertEqual(previous, false) - XCTAssertFalse( + XCTAssertEqual(previous, true) + XCTAssertTrue( window.isMovable, - "Explicit chrome drag zones may temporarily enable movement, but the main window must return to pane-tab-safe immovable state" + "Explicit chrome drag zones should preserve the window-manager-compatible movable state" ) } }