mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: preview.app window may not show when opening many docs
(closes #3276)
This commit is contained in:
@@ -87,6 +87,7 @@ extension AXUIElement {
|
||||
(
|
||||
books(runningApp) ||
|
||||
keynote(runningApp) ||
|
||||
preview(runningApp) ||
|
||||
iina(runningApp) ||
|
||||
openFlStudio(runningApp, title) ||
|
||||
crossoverWindow(runningApp, role, subrole, level) ||
|
||||
@@ -143,6 +144,12 @@ extension AXUIElement {
|
||||
return runningApp.bundleIdentifier == "com.apple.iWork.Keynote"
|
||||
}
|
||||
|
||||
private static func preview(_ runningApp: NSRunningApplication) -> Bool {
|
||||
// when opening multiple documents at once with apple Preview,
|
||||
// one of the window will have level == 1 for some reason
|
||||
return runningApp.bundleIdentifier == "com.apple.Preview"
|
||||
}
|
||||
|
||||
private static func openFlStudio(_ runningApp: NSRunningApplication, _ title: String?) -> Bool {
|
||||
// OpenBoard is a ported app which doesn't use standard macOS windows
|
||||
return runningApp.bundleIdentifier == "com.image-line.flstudio" && (title != nil && title != "")
|
||||
|
||||
@@ -8,10 +8,6 @@ extension CGWindowID {
|
||||
func level() throws -> CGWindowLevel {
|
||||
var level = CGWindowLevel(0)
|
||||
CGSGetWindowLevel(cgsMainConnectionId, self, &level)
|
||||
// in some weird cases, a window can spawn with level == 1, which is not even a publicly listed level
|
||||
if level == 1 {
|
||||
throw AxError.runtimeError
|
||||
}
|
||||
return level
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user