diff --git a/src/logic/Windows.swift b/src/logic/Windows.swift index a8c0ef5dd..411c42154 100644 --- a/src/logic/Windows.swift +++ b/src/logic/Windows.swift @@ -100,9 +100,13 @@ class Windows { static func voiceOverFocusedWindow() { guard App.app.appIsBeingUsed && App.app.thumbnailsPanel.isKeyWindow else { return } - let window = ThumbnailsView.recycledViews[focusedWindowIndex] - if window.window_ != nil && window.window != nil { - App.app.thumbnailsPanel.makeFirstResponder(window) + // it seems that sometimes makeFirstResponder is called before the view is visible + // and it creates a delay in showing the main window; calling it with some delay seems to work around this + DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(10)) { + let window = ThumbnailsView.recycledViews[focusedWindowIndex] + if window.window_ != nil && window.window != nil { + App.app.thumbnailsPanel.makeFirstResponder(window) + } } } diff --git a/src/ui/App.swift b/src/ui/App.swift index 9c2944e31..163297397 100644 --- a/src/ui/App.swift +++ b/src/ui/App.swift @@ -217,10 +217,10 @@ class App: AppCenterApplication, NSApplicationDelegate { thumbnailsPanel.thumbnailsView.updateItemsAndLayout(currentScreen) guard appIsBeingUsed else { return } thumbnailsPanel.setContentSize(thumbnailsPanel.thumbnailsView.frame.size) - Windows.voiceOverFocusedWindow() // at this point ThumbnailViews are assigned to the window, and ready thumbnailsPanel.display() guard appIsBeingUsed else { return } currentScreen.repositionPanel(thumbnailsPanel, .appleCentered) + Windows.voiceOverFocusedWindow() // at this point ThumbnailViews are assigned to the window, and ready } private func refreshSpecificWindows(_ windowsToUpdate: [Window]?, _ currentScreen: NSScreen) -> ()? {