Search code examples
macoscocoafullscreenmacos-carbonnsapplication

Detecting Full screen applications on mac


I am developing a simple application in Cocoa, and I want to detect whether any application is running in full screen mode. Is this possible?

Through runningApplications API, I can get various informations but there is no specific property related to full screen mode. Does any one know how to detect it? Is there any carbon event or API for this?


Solution

  • Anyways after trying out so many options and digging into the NSWorkspace i have found way through which we can achieve this their is notification

    "NSWorkspaceActiveSpaceDidChangeNotification"

    Apple doc says "Posted when a Spaces change has occurred." so by using we can register for it. along with this we need to use the NSWindow's property "isOnActiveSpace" , so by this we can detect when application enters full screen mode and exits from it.