• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: App Listener?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: App Listener?


  • Subject: Re: App Listener?
  • From: Rainer Brockerhoff <email@hidden>
  • Date: Thu, 8 Jan 2009 12:14:49 -0200

At 05:55 -0800 08/01/09, email@hidden wrote:
>From: Jerry Krinock <email@hidden>
>References: <email@hidden>
>	<email@hidden>
>	<email@hidden>
>	<email@hidden>
>In-Reply-To: <email@hidden>
>Date: Thu, 8 Jan 2009 05:39:57 -0800
>Message-ID: <email@hidden>
>
>On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:
>
>>does this work with Dashboard?  it seems that dashboard is a
>>background application that's always open...
>
>Well, obviously it does not.
>
>You'd need a NSWorkspaceDidActivateApplicationNotification, but it looks like there is no such thing.  You could periodically poll -[NSWorkspace activeApplication], but I hope someone has a better idea, because if you do I would not want your process running on my Mac.

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.

--
Rainer Brockerhoff  <email@hidden>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
_______________________________________________

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

  • Follow-Ups:
    • Re: App Listener?
      • From: Jonathan Hendry <email@hidden>
    • Re: App Listener?
      • From: James Montgomerie <email@hidden>
  • Prev by Date: Re: Convert GWorldPtr into a NSImage
  • Next by Date: Re: Removing CALayer after Animation
  • Previous by thread: Re: App Listener?
  • Next by thread: Re: App Listener?
  • Index(es):
    • Date
    • Thread