Skip to content

Instantly share code, notes, and snippets.

@kamataryo
Last active August 29, 2015 14:24
Show Gist options
  • Save kamataryo/9162b0c67a0e84a6cb00 to your computer and use it in GitHub Desktop.
Save kamataryo/9162b0c67a0e84a6cb00 to your computer and use it in GitHub Desktop.
this AppleScript positions 2 windows (ex. text editor and terminal) in ratio of 8:2 vertically
tell application "Finder"
set display_size to bounds of the window of the desktop
end tell
(* bounds == {0, 0, width, height} *)
set width to item 3 of display_size
set height to item 4 of display_size
set editor to { name : "Sublime Text", top : 0, height : height * 0.8 }
set terminal to { name : "Terminal", top : height * 0.8, height : height * 0.2 }
tell application "System Events"
set position of first window of application process (name of editor) to { 0, top of editor }
set position of first window of application process (name of terminal) to { 0, top of terminal }
set size of first window of application process (name of editor) to { width, height of editor }
set size of first window of application process (name of terminal) to { width, height of terminal }
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment