Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhance window switcher by focusing on second preview #487

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions DockDoor/Utilities/KeybindHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 0 additions & 9 deletions DockDoor/Utilities/Window Management/WindowUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down