Created
May 2, 2014 21:04
-
-
Save bahamas10/48e49f5de71f016e4759 to your computer and use it in GitHub Desktop.
active application notification in os x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
| { | |
| NSNotificationCenter *center = NSWorkspace.sharedWorkspace.notificationCenter; | |
| [center addObserver:self | |
| selector:@selector(callback:) | |
| name:NSWorkspaceDidActivateApplicationNotification | |
| object:nil]; | |
| } | |
| - (void)callback:(NSNotification *)d | |
| { | |
| NSRunningApplication *app = d.userInfo[NSWorkspaceApplicationKey]; | |
| NSLog(@"%@", app.localizedName); | |
| } | |
| /** | |
| 2014-05-02 14:04:22.150 AppFocus[28162:303] Alfred | |
| 2014-05-02 14:04:23.369 AppFocus[28162:303] Terminal | |
| 2014-05-02 14:04:23.379 AppFocus[28162:303] Google Chrome | |
| 2014-05-02 14:04:45.506 AppFocus[28162:303] Terminal | |
| 2014-05-02 14:04:46.943 AppFocus[28162:303] Xcode | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is sick! Im gonna port Viridian to android this weekend.