Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa: Return to previous active application?

is there a way to capture application that was previously active, before my application was brought to front by user?

I've tried to this in applicationWillBecomeActive: delegate method, but my application is already mark as active.

Thanks.

like image 402
iafonov Avatar asked Jun 16 '26 09:06

iafonov


1 Answers

Register for the NSWorkspaceDidDeactivateApplicationNotification notification in NSWorkspace. This will give you an NSRunningApplication instance of what was deactivated.

like image 118
nall Avatar answered Jun 18 '26 22:06

nall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!