如何在 OS X 10.8 中使用 Applescript 将窗口移动到目标空间? [英] How can I move a window to a target space with Applescript in OS X 10.8?

查看:29
本文介绍了如何在 OS X 10.8 中使用 Applescript 将窗口移动到目标空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最终,我正在尝试分配热键(通过 Alfred 或 Keymando),可以将最前面的应用程序移动到我的任何空间.触发applescript 似乎是最有可能获得成功的途径.我环顾四周,似乎曾经有一种方法可以通过 applescript 中的空间首选项"来做到这一点,但这在 OS X Lion 中消失了.

Ultimately I'm trying to assign hotkeys (via Alfred or Keymando) that can move the frontmost application to any of my spaces. Triggering an applescript seems the most likely route to success. I've looked around a lot and it seems there used to be a way to do this via "spaces preferences" in applescript, but this disappeared in OS X Lion.

推荐答案

如果您追求的是纯 AppleScript 解决方案,那您就不走运了.

If you’re after a pure AppleScript solution you’re out of luck.

正如您所提到的,空间"首选项窗格已消失.此外,Mission Control.app 没有要打开的字典,并且拉取窗口的属性(告诉应用程序 Finder 将 x 设置为前端查找器窗口的属性)不会显示任何与 Spaces 相关的内容.

As you mentioned the Spaces preference pane is gone. In addition, Mission Control.app has no dictionary to open, and pulling a window’s properties (tell application Finder to set x to the front finder window's properties) doesn't show anything that relates to Spaces.

System Events 的字典有一个我无法解释的 current desktop 属性,无论如何都被列为只读.

System Events’s dictionary has a current desktop property that I can’t wrangle, and in any case is listed as read only.

但是,第一个和仪表板之后的每个空间都有一个 包含在 .plist 文件 (com.apple.spaces) 中的 UUID,您可以在 ~/Library/Preferences 中找到该文件.在那个 .plist 中还有一个app-bindings"部分,这表明您过去能够通过 Exposé/Spaces 首选项面板访问的行为并没有完全消失.

However, each space after the first and the dashboard has a UUID that is contained in a .plist file (com.apple.spaces) that you can find in ~/Library/Preferences. In that .plist there is also an "app-bindings" section, which suggests that the behaviour you used to be able to access through the Exposé/Spaces preference pane is not totally gone.

不幸的是,在我的测试中,我添加了一个 dict &字符串对app-bindings",我无法强制应用程序到特定空间,即使在重新启动后也是如此.

Unfortunately in my testing, where I added a dict & string pair to "app-bindings", I couldn’t force an application to a particular space, even after a restart.

看起来,当 Apple 为 Mountain Lion 的 Mission Control 行放弃 Spaces 网格时,他们放弃了用户对每个空间中显示内容的控制,顺便说一下交互发生了变化(与用户相比,临时额外桌面-定义的网格)如果幕后的事情也发生了变化,我不会感到惊讶.

It appears that when Apple ditched the Spaces grid for Mountain Lion’s Mission Control row they threw away user control over what was to appear in each space, and by the way the interaction has changed (ad-hoc extra desktops compared with a user-defined grid) I wouldn’t be surprised if things have changed under the covers too.

这篇关于如何在 OS X 10.8 中使用 Applescript 将窗口移动到目标空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆