I am writing an IM client for Mac (in Python, but an Objective C / Cocoa solution here is fine). I want to detect whether or not the user is currently watching a movie or playin
In Mountain Lion (and probably earlier), you can track the presence of the menu bar by monitoring the distributed notifications com.apple.HIToolbox.hideMenuBarShown and com.apple.HIToolbox.hideMenuBarShown. No menu bar usually == fullscreen mode. This works across apps, so you can tell when, say, VLC goes fullscreen, or when someone switches to iCal in fullscreen mode.
To do this, register for these two notifications:
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidEnterFullScreen:)
name:@"com.apple.HIToolbox.hideMenuBarShown"
object:nil];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidExitFullScreen:)
name:@"com.apple.HIToolbox.frontMenuBarShown"
object:nil];
then create your own selectors to handle those cases. frontMenuBarShown fires all the time, so to catch a real return from fullscreen, watch for the first 'didExit' that follows a 'didEnter'...