mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
feat: improve support for crossover windows
This commit is contained in:
committed by
Louis Pontoise
parent
01b3a428d9
commit
f9f1c19b84
@@ -83,11 +83,17 @@ extension AXUIElement {
|
||||
// debugPrint(runningApp.bundleIdentifier, title, level, CGWindow.normalLevel, subrole, role, size)
|
||||
|
||||
// Some non-windows have cgWindowId == 0 (e.g. windows of apps starting at login with the checkbox "Hidden" checked)
|
||||
return wid != 0 && size != nil &&
|
||||
(books(runningApp) || keynote(runningApp) || iina(runningApp) || openFlStudio(runningApp, title) || (
|
||||
return wid != 0 && size != nil && (
|
||||
(
|
||||
books(runningApp) ||
|
||||
keynote(runningApp) ||
|
||||
iina(runningApp) ||
|
||||
openFlStudio(runningApp, title) ||
|
||||
crossoverWindow(runningApp, role, subrole, level)
|
||||
) || (
|
||||
// CGWindowLevel == .normalWindow helps filter out iStats Pro and other top-level pop-overs, and floating windows
|
||||
level == CGWindow.normalLevel &&
|
||||
([kAXStandardWindowSubrole, kAXDialogSubrole].contains(subrole) ||
|
||||
level == CGWindow.normalLevel && (
|
||||
[kAXStandardWindowSubrole, kAXDialogSubrole].contains(subrole) ||
|
||||
openBoard(runningApp) ||
|
||||
adobeAudition(runningApp, subrole) ||
|
||||
adobeAfterEffects(runningApp, subrole) ||
|
||||
@@ -100,11 +106,13 @@ extension AXUIElement {
|
||||
dvdFab(runningApp) ||
|
||||
drBetotte(runningApp) ||
|
||||
androidEmulator(runningApp, title)
|
||||
) &&
|
||||
) && (
|
||||
mustHaveIfJetbrainApp(runningApp, title, subrole, size!) &&
|
||||
mustHaveIfSteam(runningApp, title, role) &&
|
||||
mustHaveIfColorSlurp(runningApp, title, subrole)
|
||||
))
|
||||
mustHaveIfSteam(runningApp, title, role) &&
|
||||
mustHaveIfColorSlurp(runningApp, title, subrole)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private static func mustHaveIfJetbrainApp(_ runningApp: NSRunningApplication, _ title: String?, _ subrole: String?, _ size: NSSize) -> Bool {
|
||||
@@ -205,6 +213,11 @@ extension AXUIElement {
|
||||
return title != "" && Applications.isAndroidEmulator(runningApp)
|
||||
}
|
||||
|
||||
private static func crossoverWindow(_ runningApp: NSRunningApplication, _ role: String?, _ subrole: String?, _ level: CGWindowLevel) -> Bool {
|
||||
return runningApp.bundleIdentifier == nil && role == kAXWindowRole && subrole == kAXUnknownSubrole && level == CGWindow.baseLevel
|
||||
&& (runningApp.localizedName == "wine64-preloader" || runningApp.executableURL?.absoluteString.contains("/winetemp-") ?? false)
|
||||
}
|
||||
|
||||
func position() throws -> CGPoint? {
|
||||
return try value(kAXPositionAttribute, CGPoint.zero, .cgPoint)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ typealias CGWindow = [CFString: Any]
|
||||
|
||||
extension CGWindow {
|
||||
static let normalLevel = CGWindowLevelForKey(.normalWindow)
|
||||
static let baseLevel = CGWindowLevelForKey(.baseWindow)
|
||||
|
||||
static func windows(_ option: CGWindowListOption) -> [CGWindow] {
|
||||
return CGWindowListCopyWindowInfo([.excludeDesktopElements, option], kCGNullWindowID) as! [CGWindow]
|
||||
|
||||
Reference in New Issue
Block a user