如何以编程方式向任务控制添加空间?
问题描述:
我想创建一个新空间(也可以在以后删除它),而不必通过标准的misson控制gui。有什么方法来做这个程序吗?
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?
答
从GUI ...
...只是为了防止有人通过Google发现此内容
>任务控制 ...
It’s a cinch: when you’re 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