How to get the number of spaces in OSX?

I want the number of spaces in the OSX snow leopard.

If I use 4 spaces, I want this number 4!

I cannot find a function or class related to this.

+4
source share
1 answer

Information about spaces is stored in the dock settings. You can access the settings through NSUserDefaults to get the number of rows and columns, and the number of spaces is a product:

 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; 
+3
source

Source: https://habr.com/ru/post/1338615/


All Articles