objective-ccocoamacosnsnotificationcentersystemevent

Monitoring Apples "System Events" with Cocoa


I was wondering if there was a way to write a Cocoa app that listened for OS system events such as an application launching, a window switches, etc, etc. My thought was to watch [NSNotficationCenter default] for messages but so far I haven't been able to find much. Does anyone have any suggestions?

Thanks!


Solution

  • Some messages that might interest you would be provided to [NSWorkspace notificationCenter], such as when apps launch, come to the front, or quit.

    I'm not sure what you mean by "window switches". If you mean changing which window is in front without changing which app is in front, that's generally considered "none of your business" on the Mac.