Skip to content

Instantly share code, notes, and snippets.

@geetarista
Created August 28, 2014 21:37
Show Gist options
  • Save geetarista/2a7bfef6061658f53850 to your computer and use it in GitHub Desktop.
Save geetarista/2a7bfef6061658f53850 to your computer and use it in GitHub Desktop.
finder = Application("Finder")
bounds = finder.desktop.window.bounds()
width = bounds["width"]
height = bounds["height"]
query = "{query}"
boundsMap = {
"f": {"x":0, "y":0, "width":width, "height":height},
"m": {"x":width/8, "y":height/8,
"width":width/1.125, "height":height/1.125},
"tr": {"x":width/2, "y":0, "width":width, "height":height/2},
"tl": {"x":0, "y":0, "width":width/2, "height":height/2},
"th": {"x":0, "y":0, "width":width, "height":height/2},
"r": {"x":width/2, "y":0, "width":width, "height":height},
"l": {"x":0, "y":0, "width":width/2, "height":height},
"br": {"x":width/2, "y":height/2, "width":width, "height":height},
"bl": {"x":0, "y":height/2, "width":width/2, "height":height},
"bh": {"x":0, "y":height/2, "width":width, "height":height},
"h": {"x":width/4, "y":0, "width":width/1.25, "height":height},
}
SystemEvents = Application("System Events")
appName = SystemEvents.processes.whose({ frontmost: true })[0].name()
app = Application(appName)
app.windows[0].bounds = boundsMap[query]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment