Skip to content

Instantly share code, notes, and snippets.

@lululau
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save lululau/a27fee2ccf7d1c502f09 to your computer and use it in GitHub Desktop.

Select an option

Save lululau/a27fee2ccf7d1c502f09 to your computer and use it in GitHub Desktop.
Script to maximize windows of pre-selected applications on OS X
#!/bin/bash
######################################################################################################
# Add names of applications which you want to maximize to ~/.windowmaxrc, each application name in a single line, for example:
#
# -> cat ~/.windowmaxrc
# iTerm
# Safari
# Google Chrome
# MacDown
# Mail
######################################################################################################
osascript <<EOF
set processes to {$(ruby -e 'puts STDIN.map(&:chomp).map(&:inspect).*","' < ~/.windowmaxrc)}
tell application "Finder"
set _b to bounds of window of desktop
set w to item 3 of _b
set h to item 4 of _b
end tell
repeat with proc in processes
try
tell application "System Events" to tell process proc
repeat with wind in windows
tell wind
set size to {w, h}
set position to {0, 0}
end tell
end repeat
end tell
on error msg
end try
end repeat
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment