On 1 Feb 2012, at 04:43, Lee Ann Rucker wrote:

> I was afraid you were going to say Services :) When I'm using this both apps 
> are under my control.
> 
> Haven't tried this, but you could try checking which app is active in 
> applicationWillBecomeActive: and restore that when you're done.

I tried:

- (void)applicationWillBecomeActive:(NSNotification *)aNotification
{
        (void)aNotification;

        NSRunningApplication *currentApplication = [ NSRunningApplication 
currentApplication ];
        NSString *bundleIdentifier = currentApplication.bundleIdentifier;       
        NSLog(@"%s current: %@",__FUNCTION__, bundleIdentifier);
        
        NSWorkspace *sharedWorkspace = [ NSWorkspace sharedWorkspace ];
        NSArray *runningApplications = [ sharedWorkspace runningApplications ];
        for( NSRunningApplication *ru in runningApplications )
        {
                if ( ru.isActive )
                {
                        NSString *bundleIdentifier = ru.bundleIdentifier;       
                        NSLog(@"%s active: %@",__FUNCTION__, bundleIdentifier);
                };
        };
}

But both the currentApplication and the active one is our app (NOT the 
previously active one).

Although the name of the notification is applicationWillBecomeActive it acts 
more like
applicationIsAlreadySomehowActiveAndWIllBecomeFullyActiveRealSoonNow.


Kind regards,

Gerriet.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to