I get a list of CGWindow
s using CGWindowListCreate
as shown below:
CFArrayRef windows = CGWindowListCreate(kCGWindowListOptionOnScreenOnly, 0);
Is there a way to tell which NSScreen
each window is on? I've trying looking at the intersection of window bounds and the frames of the screens, but if a window is partially off screen it can intersect with the frame of another screen.
Is there a more reliable way to do this?