Skip to content

Instantly share code, notes, and snippets.

@tomkrcha
tomkrcha / gist:9009845
Created February 14, 2014 21:36
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]];