diff --git a/DockDoor/Utilities/KeybindHelper.swift b/DockDoor/Utilities/KeybindHelper.swift index 4847f29..5e17495 100644 --- a/DockDoor/Utilities/KeybindHelper.swift +++ b/DockDoor/Utilities/KeybindHelper.swift @@ -211,6 +211,15 @@ class KeybindHelper { currentMouseLocation: CGPoint, targetScreen: NSScreen) { + // If classic window ordering is enabled and there are at least two windows, + // set the initial focus on the second window preview (instead of the first). + // + // This behavior improves window switching speed and mimics the Windows OS + // experience, making it easier for users to switch between recent windows quickly. + if Defaults[.useClassicWindowOrdering], windows.count >= 2 { + SharedPreviewWindowCoordinator.shared.windowSwitcherCoordinator.setIndex(to: 1) + } + let showWindow = { (mouseLocation: NSPoint?, mouseScreen: NSScreen?) in SharedPreviewWindowCoordinator.shared.showWindow( appName: "Window Switcher", diff --git a/DockDoor/Utilities/Window Management/WindowUtil.swift b/DockDoor/Utilities/Window Management/WindowUtil.swift index 5c53786..1132e21 100644 --- a/DockDoor/Utilities/Window Management/WindowUtil.swift +++ b/DockDoor/Utilities/Window Management/WindowUtil.swift @@ -395,15 +395,6 @@ enum WindowUtil { windows = windows.filter { !$0.isHidden && !$0.isMinimized } } - // If classic ordering is enabled and there are at least two windows, - // swap the first and second windows - if Defaults[.useClassicWindowOrdering], windows.count >= 2 { - var modifiedWindows = windows - modifiedWindows.swapAt(0, 1) - return modifiedWindows - } - - // Otherwise return natural date-based ordering return windows }