I am trying to take a screenshot of each running window on the screen independently (even if not in the foreground). I am using SCScreenshotManager
's captureImageWithFilter
and SCContentFilter
's initWithDesktopIndependentWindow
. When I do this for every SCWindow
in SCShareableContent
's windows
, I do get all the actual windows, but also get many mostly blank windows or windows that no ordinary user would consider to be an actual window. These include dozens of windows with no title, some with "Focus Proxy" title, some for menu bar icons, the wallpaper, the desktop icons, etc.
I've implemented a naive solution that filters all windows that have no title, owningApplication
s with no title or bundle ID in a hardcoded blocklist (e.g. "com.apple.controlcenter", "com.apple.wallpaper.agent") and that helps, but is far from robust and is naturally fragile.
Is there a recommended way to distinguish actual application windows or an overall better approach here? Thanks!