Skip to content

Instantly share code, notes, and snippets.

@mfcollins3
Created April 24, 2020 00:01
Show Gist options
  • Save mfcollins3/c660613baf2e051c32a09c46a26fdbd4 to your computer and use it in GitHub Desktop.
Save mfcollins3/c660613baf2e051c32a09c46a26fdbd4 to your computer and use it in GitHub Desktop.
Shell script to set the size of a Mac application's window to 1080p for screen recording
#!/usr/bin/env zsh
# Original code modified from https://www.labnol.org/software/resize-mac-windows-to-specific-size/28345/
osascript <<EOF
set appHeight to 1080
set appWidth to 1920
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
tell application "$1"
activate
reopen
set yAxis to (screenHeight - appHeight) / 2 as integer
set xAxis to (screenWidth - appWidth) / 2 as integer
set the bounds of the first window to {xAxis, yAxis, appWidth + xAxis, appHeight + yAxis}
end tell
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment