Skip to content

Instantly share code, notes, and snippets.

@tomkrcha
Created February 14, 2014 21:36
Show Gist options
  • Save tomkrcha/9009845 to your computer and use it in GitHub Desktop.
Save tomkrcha/9009845 to your computer and use it in GitHub Desktop.
Detect if Mac OSX space changed in cocoa - NSWorkspaceActiveSpaceDidChangeNotification change / event / notification
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSNotificationCenter *nc = [[NSWorkspace sharedWorkspace] notificationCenter];
[nc addObserver:self
selector:@selector(spaceChanged:)
name:NSWorkspaceActiveSpaceDidChangeNotification
object:[NSWorkspace sharedWorkspace]];
NSLog(@"applicationDidFinishLaunching");
}
- (void)spaceChanged:(NSNotification *)aNotification{
NSLog(@"spaceChanged");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment