From 4782a057327cdfe47711fe2a39efe6cb33497660 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Mon, 4 Dec 2023 19:43:28 +0100 Subject: [PATCH] Fix that fullscreen is exited if window on a different monitor is focused closes https://github.com/nikitabobko/AeroSpace/issues/35 --- src/command/FocusCommand.swift | 2 +- src/tree/WorkspaceEx.swift | 7 +------ src/tree/layoutRecursive.swift | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/command/FocusCommand.swift b/src/command/FocusCommand.swift index 606e39b8..c88dbc95 100644 --- a/src/command/FocusCommand.swift +++ b/src/command/FocusCommand.swift @@ -30,7 +30,7 @@ private func makeFloatingWindowsSeenAsTiling(workspace: Workspace) -> [FloatingW let floatingWindows: [FloatingWindowData] = workspace.floatingWindows .map { (window: Window) -> FloatingWindowData? in guard let center = window.getCenter() else { return nil } - // todo bug: what if there are now tiling windows on the workspace? + // todo bug: what if there are no tiling windows on the workspace? guard let target = center.coerceIn(rect: window.workspace.monitor.visibleRectPaddedByOuterGaps).findIn(tree: workspace.rootTilingContainer, virtual: true) else { return nil } guard let targetCenter = target.getCenter() else { return nil } guard let tilingParent = target.parent as? TilingContainer else { return nil } diff --git a/src/tree/WorkspaceEx.swift b/src/tree/WorkspaceEx.swift index 6651f45a..fcfc894c 100644 --- a/src/tree/WorkspaceEx.swift +++ b/src/tree/WorkspaceEx.swift @@ -54,11 +54,6 @@ extension Workspace { func layoutWorkspace() { if isEffectivelyEmpty { return } let rect = monitor.visibleRectPaddedByOuterGaps - layoutRecursive( - rect.topLeftCorner, - width: rect.width, - height: rect.height, - virtual: rect - ) + layoutRecursive(rect.topLeftCorner, width: rect.width, height: rect.height, virtual: rect) } } diff --git a/src/tree/layoutRecursive.swift b/src/tree/layoutRecursive.swift index fd649f24..61fa74a0 100644 --- a/src/tree/layoutRecursive.swift +++ b/src/tree/layoutRecursive.swift @@ -15,7 +15,7 @@ extension TreeNode { case .window(let window): if window.windowId != currentlyManipulatedWithMouseWindowId { lastAppliedLayoutVirtualRect = virtual - if window.isFullscreen && window == focusedWindow { + if window.isFullscreen && window == workspace.mostRecentWindow { lastAppliedLayoutPhysicalRect = nil let monitorRect = window.workspace.monitor.visibleRectPaddedByOuterGaps window.setTopLeftCorner(monitorRect.topLeftCorner)