Macos 修改";空格“;plist on OSX设置默认桌面
我目前正试图通过修改10.6(和10.7)中与“空格”关联的plist,将应用程序默认为所有桌面。在Snow Leopard上,可以通过进入“系统首选项”>“公开和共享空间”设置应用程序的默认桌面,并将应用程序设置为默认显示在所有共享空间上。这与预期的一样,我的应用程序出现在所有桌面上 但是,我正在寻找一种实用的方法,并希望能够在我的应用程序中设置此功能。我找到了与每个操作系统关联的plist文件:Macos 修改";空格“;plist on OSX设置默认桌面,macos,osx-lion,plist,osx-snow-leopard,Macos,Osx Lion,Plist,Osx Snow Leopard,我目前正试图通过修改10.6(和10.7)中与“空格”关联的plist,将应用程序默认为所有桌面。在Snow Leopard上,可以通过进入“系统首选项”>“公开和共享空间”设置应用程序的默认桌面,并将应用程序设置为默认显示在所有共享空间上。这与预期的一样,我的应用程序出现在所有桌面上 但是,我正在寻找一种实用的方法,并希望能够在我的应用程序中设置此功能。我找到了与每个操作系统关联的plist文件: OS X 10.7: ~/Library/Preferences/com.apple.space
OS X 10.7: ~/Library/Preferences/com.apple.spaces.plist
及
编辑这些文件(参考应用程序桌面默认设置),然后使用killall dock重新启动dock不会影响我的应用程序在空间中的显示位置
我还尝试使用默认设置将默认桌面设置为:
defaults write com.apple.dock workspaces-app-bindings -dict-add com.mybundle.thing 65544
这也失败了,因为应用程序没有与正确的桌面(或所有桌面,如上命令所示)关联
这两种方法都会使应用程序与正确的空间分配一起显示在“系统首选项”面板中。但是,除非我直接从系统首选项分配它,否则它就无法工作
是否还有其他需要与plist一起设置的内容才能正常工作?10.7将“所有空格”存储为字符串AllSpaces
作为参考,它使用空字符串将应用程序绑定到主桌面,并基于空间的
uuid
值将应用程序绑定到其他空间。此应用程序脚本在OSX 10.8.5中为我工作,用于类似的项目,
但它只列出了每个空间的名称(我有9个空间)。这是访问plist数据的简单方法。我相信它可以被修改来重写plist
tell application "Finder" to set propsLST to alias ((home as text) & ¬
"Library:Preferences:com.apple.spaces.plist") as text
tell application "System Events" to set theSPACES to value of every property list item of property list item "Space Properties" of property list item ¬
"SpacesConfiguration" of contents of property list file propsLST
set spacesLST to {}
repeat with eachSPACE in every item of theSPACES
set {spaceNAM, spaceWNDW} to eachSPACE as list
set end of spacesLST to spaceNAM
end repeat
return spacesLST
是否有人在10.8中有幸通过编程实现了这一点,并且让系统实际上尊重您的更改,而无需您通过单击dock图标来更改和重新设置首选项?
tell application "Finder" to set propsLST to alias ((home as text) & ¬
"Library:Preferences:com.apple.spaces.plist") as text
tell application "System Events" to set theSPACES to value of every property list item of property list item "Space Properties" of property list item ¬
"SpacesConfiguration" of contents of property list file propsLST
set spacesLST to {}
repeat with eachSPACE in every item of theSPACES
set {spaceNAM, spaceWNDW} to eachSPACE as list
set end of spacesLST to spaceNAM
end repeat
return spacesLST