Last active
August 29, 2015 14:12
-
-
Save lululau/a27fee2ccf7d1c502f09 to your computer and use it in GitHub Desktop.
Script to maximize windows of pre-selected applications on OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 | |
| ###################################################################################################### | |
| 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