Saturday, December 8, 2012

Tile windows in OS X

tile windows mac
tile windows os x
tile windows mountain lion
tile windows mac os x
lion tile windows in mac os x

There are were a few programs that allowed for window tiling in Mac OS X. But for a more universal solution that works across all OS X versions and monitors, we'll have to get our hands dirty with AppleScript.

This script will tile all windows for a single application. In a future post there will be a script that will work across all windows on screen. The only part of the script you'll need to edit is the second tell application line. Where it says "Terminal" simply put the application name for which app you want to tile.
property x_index : 1
property y_index : 0
property screen_width : 0
property screen_height : 0

tell application "Finder"
    set _b to bounds of window of desktop
    set screen_width to item 3 of _b
    set screen_height to item 4 of _b
end tell

tell application "Terminal"
    set the window_count to the count of windows
    if the window_count is not greater than 1 then error number -128
    set the bounds of window 1 to {0, 0, screen_width / 4, screen_height / 4}
    copy the bounds of window 1 to {x1, y1, x2, y2}
    set the window_width to (x2 - x1)
    set the window_height to (y2 - y1)
    repeat with i from 2 to the window_count
        set the position of window i to {(x1 + window_width), (y1)}
        copy the bounds of window i to {a1, b1, a2, b2}
        copy the bounds of window i to {x1, y1, x2, y2}
        set the bounds of window i to {a1, b1, (a1 + window_width), (b1 + window_height)}
        set the x_index to x_index + 1
        if (x_index is 4) then
            set the y_index to y_index + 1
            set the x_index to 0
            set y1 to y1 + window_height
            set x1 to 0 - window_width
            if (y_index is 4) then
                set the y_index to 0
            end if
        end if
    end repeat
end tell
Some paid software you can look at
 http://www.irradiatedsoftware.com/sizeup/
http://www.irradiatedsoftware.com/cinch/

No comments:

Post a Comment