Skip to content

Commit 7245b4a

Browse files
bug: previews stop if active app has 0 windows (2)
1 parent 77fc22f commit 7245b4a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/ScriptCommands/showAppScriptCommand.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
var DockAltTabFORCEDX = 0;
2-
var DockAltTabFORCEDY = 0;
3-
var DockAltTabMode = false;
4-
var DockAltTabDockPos = "";
1+
var DockAltTabFORCEDX = 0
2+
var DockAltTabFORCEDY = 0
3+
var DockAltTabMode = false
4+
var DockAltTabDockPos = ""
5+
var DockAltTabApp: NSRunningApplication? = nil
56

67
func DockAltTabRadiusFix() {
78
if (Preferences.theme != .macOs) {return}
89
App.app.thumbnailsPanel.thumbnailsView.updateRoundedCorners(DockAltTabMode ? 15 : Appearance.windowCornerRadius) //line found in App.resetPreferencesDependentComponents
910
}
10-
func startDockAltTabMode() {
11+
func startDockAltTabMode(app: NSRunningApplication) {
1112
DockAltTabMode = true
1213
DockAltTabRadiusFix()
14+
DockAltTabApp = app
1315
}
1416
func DockAltTabResetCachedThumbnailPreviewSetting() {
1517
if (DockAltTabThumbnailPreview != nil) {
@@ -43,7 +45,7 @@ class showAppScriptCommand: NSScriptCommand {
4345
return self
4446
}
4547
if (self.evaluatedArguments!["x"] != nil || self.evaluatedArguments!["y"] != nil) {
46-
startDockAltTabMode()
48+
startDockAltTabMode(app: appInstances.first!)
4749
} else {DockAltTabReset()/*DockAltTabMode = false*/}
4850
var x = 0, y = 0
4951
if (self.evaluatedArguments!["x"] == nil) {
@@ -69,7 +71,9 @@ class showAppScriptCommand: NSScriptCommand {
6971
App.app.isFirstSummon = false
7072
App.app.shortcutIndex = 2 // Shortcut 3 = index 2 = DockAltTab
7173
NSScreen.updatePreferred()
72-
// if !Windows.updatesBeforeShowing() { App.app.hideUi(); return self } //commented out since active app = 0 windows = no previews for any tarApp, and modifying updatesBeforeShowing leads to keeping thumbnailsPanel open with 0 thumbnails (empty grey window)
74+
if !Windows.updatesBeforeShowing() {
75+
print("ydaaaaa")
76+
App.app.hideUi(); return self } //commented out since active app = 0 windows = no previews for any tarApp, and modifying updatesBeforeShowing leads to keeping thumbnailsPanel open with 0 thumbnails (empty grey window)
7377

7478
// Windows.detectTabbedWindows()
7579
// Spaces.refreshAllIdsAndIndexes()

src/logic/Windows.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ class Windows {
370370
($0.hide == .always || (window.isWindowlessApp && $0.hide != .none))
371371
}
372372
} ?? false) &&
373-
!(Preferences.appsToShow[App.app.shortcutIndex] == .active && window.application.pid != NSWorkspace.shared.frontmostApplication?.processIdentifier) &&
373+
!((Preferences.appsToShow[App.app.shortcutIndex] == .active || DockAltTabMode) && window.application.pid != (DockAltTabMode ? DockAltTabApp!.processIdentifier : NSWorkspace.shared.frontmostApplication?.processIdentifier)) &&
374374
!(!(Preferences.showHiddenWindows[App.app.shortcutIndex] != .hide) && window.isHidden) &&
375375
((!Preferences.hideWindowlessApps && window.isWindowlessApp) ||
376376
!window.isWindowlessApp &&

0 commit comments

Comments
 (0)