Skip to content

Commit

Permalink
Now ignoring Notification Center when obtaining window for drag snapping
Browse files Browse the repository at this point in the history
  • Loading branch information
rxhanson committed Sep 26, 2023
1 parent fc6e441 commit aa67f3d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Rectangle/AccessibilityElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,19 @@ extension AccessibilityElement {
}

private static func getWindowInfo(_ location: CGPoint) -> WindowInfo? {
let infos = WindowUtil.getWindowList().filter { $0.level < 1000 && !["Dock", "WindowManager"].contains($0.processName) }
if let info = (infos.first { $0.frame.contains(location) }) {
return info
let infoAtLocation = WindowUtil.getWindowList().first(where: {windowInfo in
windowInfo.level < 1000
&& !["Dock", "WindowManager", "Notification Center"].contains(windowInfo.processName)
&& windowInfo.frame.contains(location)
})

if let infoAtLocation {
Logger.log("Window found at \(location): \(infoAtLocation)")
} else {
Logger.log("Unable to obtain window info from location")
}
Logger.log("Unable to obtain window info from location")
return nil

return infoAtLocation
}

static func getWindowElementUnderCursor() -> AccessibilityElement? {
Expand Down

0 comments on commit aa67f3d

Please sign in to comment.