Skip to content Skip to sidebar Skip to footer

How Can I List All Open Windows On Mac From A Python Script?

I'd like to be able to grab a list of all windows that are open on macOS/OS X from a Python script. This would be the Mac equivalent on win32's EnumWindows API call. Ideally, I'd l

Solution 1:

You can use pyobjc. This should get the title names for you:

from AppKit import NSWorkspace
[apps["NSApplicationName"] for apps in NSWorkspace.sharedWorkspace().launchedApplications()]

A little more background: pyobjc is implemented using Quartz Window Services, which is the program they used to manage application windows on Mac OS.

Post a Comment for "How Can I List All Open Windows On Mac From A Python Script?"