• 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: Receive notifications about frontmost application change
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Receive notifications about frontmost application change


  • Subject: Re: Receive notifications about frontmost application change
  • From: James Montgomerie <email@hidden>
  • Date: Wed, 9 Jul 2008 18:58:30 +0100

On 9 Jul 2008, at 18:46, Bill Cheeseman wrote:

on 2008-07-09 11:44 AM, Jens Alfke at email@hidden wrote:

On 9 Jul '08, at 3:22 AM, Александр Даровских wrote:

Hi,
Is there any way to subscribe to frontmost application change
notification? For example, via NSDistributedNotificationCenter or
some other facility? I have managed to get process startup and
shutdown notifications, but I cannot get active application change
notification. Maybe it is done in somehow another way?

You can register to observe the accessibility notifications
AXApplicationActivated and AXApplicationDeactivated. These require you to
register to observe a specific target application. Therefore, in order to
catch every application switch, use the NSWorkspace -activeApplication
method to get the name of the current active application, register to
observe when it deactivates, then when it does deactivate get the new
-activeApplication and register to observe when it deactivates, and so on.


See Apple's iChatStatusFromApplication sample code for Leopard to see
exactly how to implement this.

This does require, though, that the user has "Enable access for assistive devices" enabled in the Universal Access preferences pane (the Carbon method does not).


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


  • Follow-Ups:
    • Re: Receive notifications about frontmost application change
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: Receive notifications about frontmost application change (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: Receive notifications about frontmost application change
  • Next by Date: Re: Redrawing CALayer subclass when super layer is scaled
  • Previous by thread: Re: Receive notifications about frontmost application change
  • Next by thread: Re: Receive notifications about frontmost application change
  • Index(es):
    • Date
    • Thread