I want to create a new space (and also be able to delete it later), without having to go through the standard misson control gui. Is there any way to do this programmatically? Either via terminal commands, applescript or some cocoa?
Asked
Active
Viewed 4,153 times
19
-
You might try this at askdifferent instead... It is more about Mac OS than programming. – beroe Mar 29 '14 at 08:55
-
I don't believe there's a way to add a general-purpose Space programmatically. I think that Apple considers that to be the user's prerogative. Putting a window into full-screen mode (i.e. `-[NSWindow toggleFullScreen:]`) creates a Space particular to that window. – Ken Thomases Mar 29 '14 at 10:40
-
This probably belongs in http://apple.stackexchange.com/ ;) – ѺȐeallү Apr 04 '14 at 21:48
2 Answers
2
There is on preference plist in ~/Library/Preferences path named as com.apple.spaces.plist.
There You have to add two keys.
Open the plist and I hope you will get to know it.

RWDJ
- 734
- 8
- 13

Vighnesh Pai
- 1,795
- 1
- 14
- 38
-
I tried adding a new entry in the plist, but that did not create a new space. Have not tried rebooting, but a solution that requires reboot is not what I'm looking for. – Erika Aug 31 '13 at 09:20
-
@Erika the Finder process needs to be restarted in order take the new preferences into account. – Maxime Nov 10 '13 at 08:57
-
2
From the GUI...
...just in case someone finds this via Google
It’s a cinch: when you’re in Mission Control...
- move your cursor to the upper right corner of the screen
- click the New Desktop tab that slides out from the edge of the screen
Note:If your Dock is on the right, you can access the New Desktop tab from the upper left corner instead.
In Mavericks, Applescript to create a new Space in Mission Control
delay 0.5 -- time to release command if the script is run with command-R
tell application "System Events"
key code 126 using control down -- control-up
delay 1
do shell script "MouseTools -x 1900 -y 60;sleep 1;MouseTools -leftClickNoRelease;MouseTools -releaseMouse"
key code 53 -- escape
end tell

ѺȐeallү
- 2,887
- 3
- 22
- 34
-
a couple of questions: 1. How could this script be modified to ensure compatibility across different screen sizes? 2. How could this script be modified to work without MouseTools? – d3vin Apr 05 '14 at 01:43