Skip to content

Instantly share code, notes, and snippets.

@HalCanary
Last active June 7, 2021 13:12
Show Gist options
  • Save HalCanary/fddb85ab36bdcf9f236398515e86c0e2 to your computer and use it in GitHub Desktop.
Save HalCanary/fddb85ab36bdcf9f236398515e86c0e2 to your computer and use it in GitHub Desktop.
MacOS: Vertically Maximize All Open Windows
#! /usr/bin/env osascript
## Vertically maximize all open windows.
tell application "Finder" to set BNDS to (bounds of window of desktop)
set DESKTOP_HEIGHT to item 4 of BNDS
tell application "System Events" to repeat with P in application processes whose background only is false
tell application "System Events" to tell P
repeat with WIN in windows of P
if the value of attribute "AXMinimized" of WIN is false
tell WIN
set {X, Y} to position
set {W, H} to size
set position to {X, 0}
set size to {W, DESKTOP_HEIGHT}
end tell
end if
end repeat
end tell
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment