File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,7 @@ class Window {
178178 } else if let bundleID = application. runningApplication. bundleIdentifier, bundleID == App . id {
179179 App . shared. activate ( ignoringOtherApps: true )
180180 App . app. window ( withWindowNumber: Int ( cgWindowId!) ) ? . makeKeyAndOrderFront ( nil )
181+ Windows . previewFocusedWindowIfNeeded ( )
181182 } else {
182183 // macOS bug: when switching to a System Preferences window in another space, it switches to that space,
183184 // but quickly switches back to another window in that space
@@ -189,6 +190,9 @@ class Window {
189190 _SLPSSetFrontProcessWithOptions ( & psn, self . cgWindowId!, SLPSMode . userGenerated. rawValue)
190191 self . makeKeyWindow ( psn)
191192 self . axUiElement. focusWindow ( )
193+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + . milliseconds( 50 ) ) {
194+ Windows . previewFocusedWindowIfNeeded ( )
195+ }
192196 }
193197 }
194198 }
Original file line number Diff line number Diff line change @@ -109,13 +109,15 @@ class App: AppCenterApplication, NSApplicationDelegate {
109109 App . shared. terminate ( self )
110110 }
111111
112- func hideUi( ) {
112+ func hideUi( _ keepPreview : Bool = false ) {
113113 debugPrint ( " hideUi " )
114114 appIsBeingUsed = false
115115 isFirstSummon = true
116116 MouseEvents . toggle ( false )
117117 hideThumbnailPanelWithoutChangingKeyWindow ( )
118- previewPanel. orderOut ( nil )
118+ if !keepPreview {
119+ previewPanel. orderOut ( nil )
120+ }
119121 hideAllTooltips ( )
120122 }
121123
@@ -205,12 +207,14 @@ class App: AppCenterApplication, NSApplicationDelegate {
205207 }
206208
207209 func focusSelectedWindow( _ selectedWindow: Window ? ) {
208- hideUi ( )
210+ hideUi ( true )
209211 if let window = selectedWindow, !MissionControl. isActive ( ) {
210212 window. focus ( )
211213 if Preferences . cursorFollowFocusEnabled {
212214 moveCursorToSelectedWindow ( window)
213215 }
216+ } else {
217+ previewPanel. orderOut ( nil )
214218 }
215219 }
216220
You can’t perform that action at this time.
0 commit comments