Skip to content

Instantly share code, notes, and snippets.

@rakuishi
Last active November 12, 2016 02:18
Show Gist options
  • Save rakuishi/1b0985cc7fec45e57e72fb99cd989208 to your computer and use it in GitHub Desktop.
Save rakuishi/1b0985cc7fec45e57e72fb99cd989208 to your computer and use it in GitHub Desktop.
(*
* Before running following codes, this script has to be allowed assistive access.
* System Preferences -> Security & Privacy -> Privacy -> Accessibility
*)
tell application "Finder"
set desktopBounds to bounds of window of desktop
set desktopWidth to item 3 of desktopBounds
set desktopHeight to item 4 of desktopBounds
end tell
tell application "System Events"
set process1 to item 1 of (every process whose frontmost is true)
tell process1
set window1 to item 1 of (every window whose subrole is "AXStandardWindow")
set position of window1 to {0, 0}
set size of window1 to {desktopWidth / 2, desktopHeight}
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment