redhotvengeance
redhotvengeance

Reputation: 27886

Listen for events from other Cocoa Applications

Is there any way to (in Cocoa) listen for specific, generic events occurring in other concurrently running applications? That is to say, can I listen for when another application open, saves, closes, quits, etc? Do Mac applications broadcast a certain set of generic events that I can listen for?

Alternatively, if my application is not in focus, could I listen for certain key-stroke commands, like cmd-o (for open), cmd-s (for save), cmd-w (for close), cmd-q (for quit), etc, as a backend way of listening for events in other applications?

Upvotes: 1

Views: 852

Answers (2)

ughoavgfhw
ughoavgfhw

Reputation: 39925

If you want something simpler than distributed objects (suggested by Neilvert), you could use distributed notifications from the distributed notification center. However, these are not posted unless you built the application. For monitoring when applications start or quit, you can use NSWorkspace and its notification center. These notifications are sent for every application which appears in the dock.

Upvotes: 1

Neilvert Noval
Neilvert Noval

Reputation: 1695

You may want to consider Distributed Objects. See reference link here.

Upvotes: 1

Related Questions