Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I can move a window to the top left corner of a screen using something like this in slate

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

usually when I fire sequel pro.. i like to automatically make four windows of it cover four quadrants of the screen.

I was wondering if I can bind a key in slate to make that automatically (it's ok if i have to manually create four windows of it.. all i need is slate to actually place those windows in the right spots).

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I couldn't figure out how to do it without hard-coding the application name, but try something like this:

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

If you have one only screen, you can use an AppleScript like this:

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

This creates four new TextEdit windows and tiles them on the screen:

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
share|improve this answer
    
oh my God.. you are good –  abbood Apr 19 at 4:27
    
it worked perfectly with the textedit app.. however with a couple of other apps including sequel pro and google chrome and the script tiles all of the four windows on the top left corner.. i just changed the application name in the command nothing else.. any idea what that's happening? –  abbood Apr 19 at 4:35
    
after some playing around.. i realized that your script (the slate one) works on apps that have a no spaces in them (ie TextEdit or SourceTree).. however apps like 'Google Chrome' or 'Pro Sequel' assume that you're applying the command only to the first argument.. any idea how to address that? –  abbood Apr 19 at 4:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.