fix: alt-tab own windows were not shown in alt-tab (closes #555)
This commit is contained in:
1 parent
be4c5f1903
commit
8bcbc04164
2 files changed
+6
-3
No files matched your search
@@ -92,7 +92,7 @@ class Applications {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static func isActualApplication(_ app: NSRunningApplication) -> Bool {
|
private static func isActualApplication(_ app: NSRunningApplication) -> Bool {
|
||||||
return (app.activationPolicy != .prohibited || isNotXpc(app)) && notAltTab(app)
|
return app.activationPolicy != .prohibited || isNotXpc(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func isNotXpc(_ app: NSRunningApplication) -> Bool {
|
private static func isNotXpc(_ app: NSRunningApplication) -> Bool {
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ func retryAxCallUntilTimeout_(_ group: DispatchGroup?, _ fn: @escaping () throws
|
|||||||
func handleEvent(_ type: String, _ element: AXUIElement) throws {
|
func handleEvent(_ type: String, _ element: AXUIElement) throws {
|
||||||
debugPrint("Accessibility event", type, try element.title() ?? "nil")
|
debugPrint("Accessibility event", type, try element.title() ?? "nil")
|
||||||
// events are handled concurrently, thus we check that the app is still running
|
// events are handled concurrently, thus we check that the app is still running
|
||||||
if let pid = try element.pid() {
|
if let pid = try element.pid(),
|
||||||
|
try (!(pid == ProcessInfo.processInfo.processIdentifier && element.subrole() == "AXUnknown")) {
|
||||||
switch type {
|
switch type {
|
||||||
case kAXApplicationActivatedNotification: try applicationActivated(element)
|
case kAXApplicationActivatedNotification: try applicationActivated(element)
|
||||||
case kAXApplicationHiddenNotification,
|
case kAXApplicationHiddenNotification,
|
||||||
@@ -120,7 +121,9 @@ private func windowCreated(_ element: AXUIElement, _ pid: pid_t) throws {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func focusedWindowChanged(_ element: AXUIElement, _ pid: pid_t) throws {
|
private func focusedWindowChanged(_ element: AXUIElement, _ pid: pid_t) throws {
|
||||||
if let wid = try element.cgWindowId() {
|
if let wid = try element.cgWindowId(),
|
||||||
|
pid != ProcessInfo.processInfo.processIdentifier ||
|
||||||
|
(App.app.preferencesWindow.isKeyWindow || App.app.feedbackWindow?.isKeyWindow ?? false) {
|
||||||
let axTitle = try element.title()
|
let axTitle = try element.title()
|
||||||
let subrole = try element.subrole()
|
let subrole = try element.subrole()
|
||||||
let role = try element.role()
|
let role = try element.role()
|
||||||
|
|||||||
Reference in new issue
Block a user