Way to create new desktop spaces from keyboard only


We all know there is a way to to switch between desktops using keyboard shortcuts,
but can we create new ones using only the keyboard?

Best Answer

You can do it with some AppleScript. This will create a new desktop every time you run it:

tell application "System Events"
    do shell script "/Applications/Mission\\ Control.app/Contents/MacOS/Mission\\ Control"
    tell process "Dock"
        set countDesktops to count buttons of list 1 of group 1
        --new desktop
        click button 1 of group 1
        --switch to new desktop
        repeat until (count buttons of list 1 of group 1) = (countDesktops + 1)
        end repeat
        click button (countDesktops + 1) of list 1 of group 1
    end tell
end tell

You can save this as a Universal Service you can assign a globally-available shortcut key combination to call it.

Credit where credit is due.