Skip to content

Instantly share code, notes, and snippets.

@arleym
Created February 28, 2016 13:37
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arleym/25d07237d9591817c096 to your computer and use it in GitHub Desktop.
Save arleym/25d07237d9591817c096 to your computer and use it in GitHub Desktop.
Alfred Layout Alpha
on alfred_script(q)
tell application "Google Chrome" to activate -- needs to be in front
tell application "System Events" to tell application process "Chrome"
try
repeat with x from 1 to (count windows)
get properties of window x
set position of window x to {0, 21}
set size of window x to {1280, 709}
end repeat
end try
end tell
tell application "Mail" to activate -- needs to be in front
tell application "System Events" to tell application process "Mail"
try
repeat with x from 1 to (count windows)
get properties of window x
set position of window x to {1280, 732}
set size of window x to {1280, 709}
end repeat
end try
end tell
tell application "HipChat" to activate -- needs to be in front
tell application "System Events" to tell application process "HipChat"
try
get properties of window 1
set position of window 1 to {1280, 732} -- eye ballin
set size of window 1 to {770, 709}
end try
end tell
tell application "Slack" to activate -- needs to be in front
tell application "System Events" to tell application process "Slack"
try
get properties of window 1
set position of window 1 to {1280, 732} -- eye ballin
set size of window 1 to {800, 709}
end try
end tell
tell application "Sublime Text" to activate -- needs to be in front
tell application "System Events" to tell application process "Sublime Text"
try
repeat with x from 1 to (count windows)
get properties of window x
set position of window x to {0, 732}
set size of window x to {1280, 709}
end repeat
end try
end tell
tell application "SourceTree" to activate -- needs to be in front
tell application "System Events" to tell application process "SourceTree"
try
repeat with x from 1 to (count windows)
get properties of window x
set position of window x to {2051, 732}
set size of window x to {510, 709}
end repeat
end try
end tell
tell application "iTerm" to activate -- needs to be in front
tell application "System Events" to tell application process "iTerm"
try
get properties of window 1
set position of window 1 to {1281, 21}
set size of window 1 to {1280, 714}
end try
end tell
end alfred_script
@arleym
Copy link
Author

arleym commented Feb 28, 2016

I have a workflow with a few "L " prefixed commands. I use Divvy for most on-the-fly stuff, but a mass resize is often needed, particularly when switching from laptop to external monitor.

Things to consider:

  1. The above script is the layout I use most. It loops through all instances of an application when there are multiple windows open. I couldn't ever get percentages working, so this is pretty specific to a 27" Cinema Display.
  2. Photoshop is a non-cocoa window, it'll go rogue. The best way to deal with it is to click the green (+) button in the top right of its window - this makes Photoshop fill the screen (in a way that is actually unlike most apps reaction to that button!)
  3. I suspect something about this workflow breaks iTerm panes back into tabs - not consistently though. I've been learning tmux as a result.

screen shot 2016-02-28 at 08 35 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment