Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 924
sandy Surname or Initialc Avatar asked Apr 08 '13 06:04

sandy Surname or Initialc


2 Answers

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.

like image 148
user3007353 Avatar answered Sep 21 '22 01:09

user3007353


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.

like image 36
sandy Surname or Initialc Avatar answered Sep 20 '22 01:09

sandy Surname or Initialc