I want the number of Spaces in OSX snow leopard.
If I use 4 spaces, I want that number 4!
I can't find a function or a class related with that.
I want the number of Spaces in OSX snow leopard.
If I use 4 spaces, I want that number 4!
I can't find a function or a class related with that.
Information about Spaces is stored in Dock preferences. You can access the preferences via NSUserDefaults
to get the number of rows and columns, and the number of spaces is the product of those:
NSDictionary *dockPrefs = [[NSUserDefaults standardUserDefaults]
persistentDomainForName:@"com.apple.dock"];
int rows = [[dockPrefs objectForKey:@"workspaces-rows"] intValue];
int cols = [[dockPrefs objectForKey:@"workspaces-cols"] intValue];
int nspaces = rows * cols;