Domanda

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?

È stato utile?

Soluzione 2

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.

Altri suggerimenti

I ran into this in the spring and spent forever trying to get it to work. I ended up packaging my code up into a little GitHub project, but I completely forgot to share it here.

https://github.com/shinypb/FullScreenDetector

Hope this is useful for someone.

You want to key-value observe -[NSApplication currentSystemPresentationOptions]. When the active app is in full-screen mode, that property will include NSApplicationPresentationFullScreen.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top