Skip to content

Instantly share code, notes, and snippets.

@mfcollins3
Created April 23, 2020 23:58
Show Gist options
  • Select an option

  • Save mfcollins3/081f75fbe68671af1476fb4bd2b4e221 to your computer and use it in GitHub Desktop.

Select an option

Save mfcollins3/081f75fbe68671af1476fb4bd2b4e221 to your computer and use it in GitHub Desktop.
Shell script to resize Visual Studio Code's window to 720p 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 appWidth to 1280
set appHeight to 720
tell application "Finder"
set screenResolution to bounds of window of desktop
end
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 or screenResolution
set xOrigin to (screenWidth - appWidth) / 2 as integer
set yOrigin to (screenHeight - appHeight) / 2 as integer
tell application "System Events"
tell process "Electron"
tell window 1
set its size to [appWidth, appHeight]
set its position to [xOrigin, yOrigin]
end
end
end
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment