4

As the title says, I would like new windows to open in a set screen size. I believe that the default is that they open in the size of the last window. Sometimes, I want to make a window smaller for some reason, but I want new windows to open as usual. Is there a shell script/command to accomplish this? Thanks

4

I use the following bookmark, which you can create as many as needed, to resize my safari window to a specific size:

javascript:self.moveTo(0,0);self.resizeTo(1250,screen.availHeight);

This moves the window to the far left, top and then makes the width 1250 pixels and makes the hight fill to the available (limited by the dock hight, if not hidden).

To use, bookmark any page and then edit the address with the code above.

Every now and again, an update to safari will break this, and then it'll work again after a subsequent update.

8
  • That's brilliant. I'll try it as soon as I get home. Thanks! – ICL1901 Nov 17 '13 at 21:23
  • Works as advertised, thank you very much. Follow on question though. Is there a way to know my current screen size? – ICL1901 Nov 18 '13 at 14:52
  • 1
    Easy peasy, just type this into terminal: system_profiler SPDisplaysDataType | grep Resolution – quip Nov 18 '13 at 21:18
  • By the by, the command above will show the max resolution your screen has, not the current. I'm looking into that. Also, the menu bar height is (I think) 22 pixels, which would need to be deducted from a maximum window height if you don't use screen.availHeight. – quip Nov 18 '13 at 21:33
  • 1
    Rohkay! It seems there's an issue with pixel resolution and window point size. If you are using a retina display, you are actually working with point size. I came across a simple and clever way to measure any screen element's point size by using the Screen Capture app. Just press Command (⌘) + Shift + 4 and then drag across an area on the screen. The crosshairs will show you the x,y point coordinates. Press Esc to avoid taking a screen shot. Credit this site. That should do you. – quip Nov 18 '13 at 22:25
1

There is a great extension available for Safari called ResponsiveResize which works great for me: http://www.midwinter-dg.com/downloads_safari-extension_responsive-resize.html

You must log in to answer this question.

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