diff --git a/Sources/AppBundle/command/impl/FocusCommand.swift b/Sources/AppBundle/command/impl/FocusCommand.swift index 8dcd0ac0..d3390420 100644 --- a/Sources/AppBundle/command/impl/FocusCommand.swift +++ b/Sources/AppBundle/command/impl/FocusCommand.swift @@ -135,7 +135,7 @@ struct FocusCommand: Command { let tilingParent: TilingContainer let index: Int if let target = center.coerce(in: workspace.workspaceMonitor.visibleRectPaddedByOuterGaps)? - .findWindowRecursively(in: workspace.rootTilingContainer, virtual: true) + .findWindowRecursively(in: workspace.rootTilingContainer, virtual: true, fullscreenCoversAll: false) { guard let targetCenter = try? await target.getCenter(.nonCancellable) else { continue } guard let _tilingParent = target.parent as? TilingContainer else { continue } diff --git a/Sources/AppBundle/mouse/focusFollowsMouse.swift b/Sources/AppBundle/mouse/focusFollowsMouse.swift index fa06145c..f57550d0 100644 --- a/Sources/AppBundle/mouse/focusFollowsMouse.swift +++ b/Sources/AppBundle/mouse/focusFollowsMouse.swift @@ -39,7 +39,9 @@ import AppKit break } } - if window == nil { window = location.findWindowRecursively(in: workspace.rootTilingContainer, virtual: false) } + if window == nil { + window = location.findWindowRecursively(in: workspace.rootTilingContainer, virtual: false, fullscreenCoversAll: true) + } if let window { try await runLightSession(.focusFollowsMouse, token) { _ = window.focusWindow() diff --git a/Sources/AppBundle/mouse/moveWithMouse.swift b/Sources/AppBundle/mouse/moveWithMouse.swift index c1f1e9f1..867ee690 100644 --- a/Sources/AppBundle/mouse/moveWithMouse.swift +++ b/Sources/AppBundle/mouse/moveWithMouse.swift @@ -52,7 +52,9 @@ private func moveTilingWindow(_ window: Window) { window.lastAppliedLayoutPhysicalRect = nil let mouseLocation = mouseLocation let targetWorkspace = mouseLocation.monitorApproximation.activeWorkspace - let swapTarget = mouseLocation.findWindowRecursively(in: targetWorkspace.rootTilingContainer, virtual: false)?.takeIf { $0 != window } + let swapTarget = mouseLocation + .findWindowRecursively(in: targetWorkspace.rootTilingContainer, virtual: false, fullscreenCoversAll: false)? + .takeIf { $0 != window } if targetWorkspace != window.nodeWorkspace { // Move window to a different monitor let index: Int = if let swapTarget, let parent = swapTarget.parent as? TilingContainer, let targetRect = swapTarget.lastAppliedLayoutPhysicalRect { mouseLocation.getProjection(parent.orientation) >= targetRect.center.getProjection(parent.orientation) @@ -84,9 +86,15 @@ func swapWindows(mruDominant window1: Window, _ window2: Window) { extension CGPoint { @MainActor - func findWindowRecursively(in tree: TilingContainer, virtual: Bool) -> Window? { - if let window = tree.mostRecentWindowRecursive, window.isFullscreen { - return window + func findWindowRecursively( + in tree: TilingContainer, + virtual: Bool, + fullscreenCoversAll: Bool, + ) -> Window? { + if fullscreenCoversAll { + if let window = tree.mostRecentWindowRecursive, window.isFullscreen { + return window + } } return _findWindowRecursively(in: tree, virtual: virtual) }