Re: App Listener?
Re: App Listener?
- Subject: Re: App Listener?
- From: James Montgomerie <email@hidden>
- Date: Thu, 8 Jan 2009 15:09:54 +0000
On 8 Jan 2009, at 14:14, Rainer Brockerhoff wrote:
Today, the only solution seems to be to install a Carbon Event
handler for the {kEventClassApplication, kEventAppFrontSwitched}
event.
Even if such a NSWorkspace notification were to appear in a future
version of Mac OS X, I'd be interested in a lower-level solution. I
have a background process that can't link to AppKit due to security
restrictions, and Carbon Events have gone away for 64-bit processes.
I did look at how HIToolbox does its magic, but it appears to be
listening to a private notification from the Process Manager. And
BSD, of course, has no concept of "front process". If nobody knows
another public API for an app activation notification, I'll file an
enhancement request.
If you don't mind asking your users to switch on accessibility access
("enable access for assistive devices" in the Universal Access
preferences), you can use the Accessibility APIs to monitor app
switching (this is what's used in the iChatStatusFromApplication
sample code, for example - http://developer.apple.com/samplecode/iChatStatusFromApplication/)
.
I say this informationally - I don't think it's a great solution either.
Jamie.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden