Skip to content

Commit 153301a

Browse files
committed
fix: apps with windows in cache not fetching new active windows on dock hover
1 parent 692952c commit 153301a

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

DockDoor/Utilities/DockObserver.swift

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -240,35 +240,31 @@ final class DockObserver {
240240

241241
guard Defaults[.enableDockPreviews] else { return }
242242

243-
if cachedWindows.isEmpty {
244-
guard Self.isSpecialControlsApp(currentApp.bundleIdentifier), Defaults[.showSpecialAppControls] else {
245-
return
246-
}
247-
}
248-
249243
let mouseScreen = NSScreen.screenContainingMouse(currentMouseLocation)
250244
let convertedMouseLocation = DockObserver.nsPointFromCGPoint(currentMouseLocation, forScreen: mouseScreen)
251-
252-
previewCoordinator.showWindow(
253-
appName: currentAppInfo.localizedName ?? "Unknown",
254-
windows: cachedWindows,
255-
mouseLocation: convertedMouseLocation,
256-
mouseScreen: mouseScreen,
257-
dockItemElement: dockItemElement,
258-
overrideDelay: false,
259-
onWindowTap: { [weak self] in
260-
self?.hideWindowAndResetLastApp()
261-
},
262-
bundleIdentifier: currentAppInfo.bundleIdentifier
263-
)
264-
265-
previousStatus = .success(currentApp)
266-
267245
let screenOrigin = mouseScreen.frame.origin
268246
let currentAppPID = currentApp.processIdentifier
269-
let currentAppIsHidden = currentApp.isHidden
270247
let currentAppBundleId = currentApp.bundleIdentifier
271248

249+
let shouldShowCachedPreview = !cachedWindows.isEmpty ||
250+
(Self.isSpecialControlsApp(currentApp.bundleIdentifier) && Defaults[.showSpecialAppControls])
251+
252+
if shouldShowCachedPreview {
253+
previewCoordinator.showWindow(
254+
appName: currentAppInfo.localizedName ?? "Unknown",
255+
windows: cachedWindows,
256+
mouseLocation: convertedMouseLocation,
257+
mouseScreen: mouseScreen,
258+
dockItemElement: dockItemElement,
259+
overrideDelay: false,
260+
onWindowTap: { [weak self] in
261+
self?.hideWindowAndResetLastApp()
262+
},
263+
bundleIdentifier: currentAppInfo.bundleIdentifier
264+
)
265+
previousStatus = .success(currentApp)
266+
}
267+
272268
Task.detached { [weak self] in
273269
guard let self else { return }
274270

0 commit comments

Comments
 (0)