MacOS – Keyboard Shortcut for Creating a new Desktop (new Space) on MacOS

desktopmacosspaces

How do I create a new Desktop ("Space") on macOS using only the keyboard?

Best Answer

Found a solution with apple script here, credit to @codehearts: https://github.com/ianyh/Amethyst/issues/143

tell application "System Events"
  do shell script "/Applications/Mission\\ Control.app/Contents/MacOS/Mission\\ Control"
  click button 1 of group "Spaces Bar" of group 1 of group "Mission Control" of process "Dock"
  do shell script "/Applications/Mission\\ Control.app/Contents/MacOS/Mission\\ Control"
end tell

The script can be either saved as a ...applescript file with #!/usr/bin/osascript line to run in the shell, or bind to a key directly in Alfred to start a new desktop through Mission Control.