1

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 1920x1080 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 1920x1080. My screen resolution is 2880x1800 (macbook pro 15" retina)

6
  • Probably characters, not pixels Aug 5, 2019 at 1:26
  • based on all the links I could find it's supposed to be in pixels
    – kinvo88
    Aug 5, 2019 at 5:44
  • Retina displays are normally scaled (or things get really small). Try something smaller. Aug 5, 2019 at 8:00
  • See what gets returned if you run this: tell application id "com.apple.finder" to get bounds of desktop's window. That will give you the maximal bounds that can be contained within the visible portion of the screen.
    – CJK
    Aug 5, 2019 at 17:34
  • 1
    I need to set my terminal window to exactly 1920x1080 size for screen recording.
    – kinvo88
    Aug 5, 2019 at 23:17

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .