如何使用 Slate 让同一应用的四个窗口填充屏幕的四个象限

如何使用 Slate 让同一应用的四个窗口填充屏幕的四个象限

我可以使用类似这样的方法将窗口移动到屏幕的左上角石板

bind a:shift;cmd;alt move screenOriginX;screenOriginY screenSizeX/2;screenSizeY/2

通常当我开火时续集专业版..我喜欢自动让它的四个窗口覆盖屏幕的四个象限。

我想知道我是否可以在 Slate 中绑定一个键以自动完成这个操作(如果我必须手动创建它的四个窗口,那么没问题......我需要的只是 Slate 将这些窗口实际放置在正确的位置)。

答案1

我无法弄清楚如何在不对应用程序名称进行硬编码的情况下做到这一点,但是请尝试以下操作:

alias topleft move screenOriginX;screenOriginY screenSizeX/2;screenSizeY/2
alias topright move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY/2
alias bottomleft move screenOriginX;screenOriginY+screenSizeY/2 screenSizeX/2;screenSizeY/2
alias bottomright move screenOriginX+screenSizeX/2;screenOriginY+screenSizeY/2 screenSizeX/2;screenSizeY/2

layout texteditquadrants 'TextEdit' ${topleft} | ${topright} | ${bottomleft} | ${bottomright}
bind 1:ctrl layout texteditquadrants

如果您只有一个屏幕,则可以使用如下 AppleScript:

tell application "Finder"
    set {0, 0, w, h} to bounds of window of desktop
end tell
tell application "System Events" to tell (process 1 where frontmost is true)
    set n to number of windows
    if n > 4 then set n to 4
    repeat with i from 1 to n
        set p to item i of {{0, 22}, {w / 2, 22}, {w / 2, h / 2 + 11}, {w / 2, h / 2 + 11}}
        set position of window i to p
        set size of window i to {w / 2, h / 2 - 11}
    end repeat
end tell

这将创建四个新的 TextEdit 窗口并将它们平铺在屏幕上:

tell application "Finder"
    set {0, 0, w, h} to bounds of window of desktop
end tell
set ytop to 22
set yhalf to (h - 22) / 2
tell application "TextEdit"
    close windows
    repeat with i from 1 to 4
        make new document
    end repeat
    set bounds of window 1 to {0, ytop, w / 2, yhalf}
    set bounds of window 2 to {w / 2, ytop, w, yhalf}
    set bounds of window 3 to {0, yhalf, w / 2, h}
    set bounds of window 4 to {w / 2, yhalf, w, h}
end tell

相关内容