Cocoa - 以编程方式将应用程序添加到所有空间

Lar*_*nes 5 cocoa spaces nswindow

有没有办法以编程方式将应用程序添加到所有空间?我希望我的应用程序默认位于所有空间。

Lar*_*nes 1

好的。仅以编程方式设置工作区应用程序绑定是行不通的。我试过:

1) Verified no entries were in System Preferences->Spaces

2) defaults write com.apple.dock workspaces-app-bindings -dict-add com.apple.mail 65544

3) killall Dock (also needed to kill System Preferences )

4) Opened System Preferences->Spaces to verify the Mail app entry 
   appeared and was set to Every Space

5) Launched Mail, but it was still stuck to Space 1

6) Only when I went back into System Preferences->Spaces and changed the 
   Mail app *from* Every Space and then *back* to Every Space did the Mail 
   app stick to every space
Run Code Online (Sandbox Code Playgroud)

很明显,系统偏好设置正在做一些额外的事情来激活该设置。有谁知道这可能是什么?谢谢!

更新:所以我能够通过使用 applescript api 而不是用户默认 api 来实现此功能。下面的文章讲述了如何使用 applescript 附加条目。然后干掉码头。

苹果脚本;在 N 号空间打开应用程序