Discovery of full-screen applications on Mac

I am developing a simple application in Cocoa, and I want to determine if any application is running in full screen. Is it possible?

In the runApplications API, I can get various information, but there is no special property associated with full-screen mode. Does anyone know how to detect it? Is there any carbon event or API for this?

+6
source share
3 answers

In any case, after you tried so many options and migrated to NSWorkspace, I found a way by which we can achieve this, this notification

"NSWorkspaceActiveSpaceDidChangeNotification"

Apple doc says "Added when a change of spaces occurred." therefore we can register for this. along with this we need to use the NSWindow property "isOnActiveSpace", so we can detect when the application enters and exits full-screen mode.

+2
source

I came across this in spring and spent forever trying to get it to work. I ended up packing my code in a small GitHub project, but I completely forgot to share it here.

https://github.com/shinypb/FullScreenDetector

Hope this is helpful to someone.

+3
source

You want to watch the key -[NSApplication currentSystemPresentationOptions] . When the active application is in full screen mode, this property will include NSApplicationPresentationFullScreen .

+2
source

All Articles