Skip to content

Instantly share code, notes, and snippets.

@rithvikgv
rithvikgv / gist:1916925
Created February 26, 2012 13:53
AppleScript to snap windows to the right à la Windows 7 Aero Snap
-- get Dock height
tell application "System Events" to tell process "Dock"
set dock_dimensions to size in list 1
set dock_height to item 2 of dock_dimensions
end tell
-- get the new width and height for the window
tell application "Finder"
set desktop_dimensions to bounds of window of desktop
set new_width to (item 3 of desktop_dimensions) / 2
set new_height to (item 4 of desktop_dimensions) - dock_height
@rithvikgv
rithvikgv / gist:1916910
Created February 26, 2012 13:51
AppleScript to snap windows to the left à la Windows 7 Aero Snap
-- get Dock height
tell application "System Events" to tell process "Dock"
set dock_dimensions to size in list 1
set dock_height to item 2 of dock_dimensions
end tell
-- get the new width and height for the window
tell application "Finder"
set desktop_dimensions to bounds of window of desktop
set new_width to (item 3 of desktop_dimensions) / 2
set new_height to (item 4 of desktop_dimensions) - dock_height