Applescript to set terminal window to specific size

applescriptresolutionterminal

I found this question Is it possible to define the width/height of a Terminal window with this command: osascript -e \'tell application "Terminal" to do script

and tried setting my Terminal window resolution to 1920×1080 with

osascript -e 'tell application "Terminal" to set bounds of front window to {0, 0, 1920, 1080}'

but the width of the window stretches over the entire screen and it's definitely not 1920×1080. My screen resolution is 2880×1800 (macbook pro 15" retina)

Best Answer

Scaled-down values need to be given to osascript. You'll need to experiment as CJK said.

In my case, I want a size that is the same proportions as HD (1920x1080), but maximize my screen width. I made my Terminal the full width and height of the screen (manually, not with the "full screen" button because I want to preserve the menu bar). Then ran:

osascript -e 'tell application "Terminal" to get bounds of front window'

=> 0, 23, 1440, 900

So, it looks like the menu bar is 23 pixels, and the width used by osascript is 1440. 1440 width in an HD ratio is 1440x810.

So, the command for me that results in a max width window that is HD ratio is:

osascript -e 'tell application "Terminal" to set bounds of front window to {0, 23, 1440, 833}'

The 833 is 810 + 23 to account for the menu bar height.