Setting Dimensions of OS X Finder Windows

S

One small annoyance I have with the Mac OS X Finder is its apparent inability to let me set a default Finder window size. However many times I resize windows with the mouse, the Finder will eventually reset them to some arbitrary dimensions.

If, like me, you find this aspect of the Finder’s behaviour particularly irksome then try this AppleScript.

Dummy Content
if localIP contains "xxx.xxx.x.xx" then
	-- iMac
	set defaultWidth to 808
	set defaultHeight to 471
	set defaultSidebarWidth to 192
else if localIP contains "xxx.xxx.x.xx" then
	-- MacBook
	set defaultWidth to 758
	set defaultHeight to 421
	set defaultSidebarWidth to 142
end if

tell application "Finder"

	display dialog "Resize Finder Window(s)…." buttons {"Front", "All"} default button 1 giving up after 100

	if button returned of result contains "Front" then
		-- Front Finder Window only
		try
			set frontWindow to front Finder window
			set current view of frontWindow to column view
			set {windowLeft, windowTop, windowRight, windowBottom} to get bounds of frontWindow
			set bounds of frontWindow to {windowLeft, windowTop, windowLeft + defaultWidth, windowTop + defaultHeight}
			set sidebar width of frontWindow to defaultSidebarWidth
			set tBar to toolbar visible of frontWindow
			set toolbar visible of frontWindow to not tBar
			set toolbar visible of frontWindow to tBar
		end try

	else
		-- All Finder Windows
		repeat with x from 1 to count of Finder windows
			try
				set frontWindow to Finder window x
				set {windowLeft, windowTop, windowRight, windowBottom} to get bounds of frontWindow
				set bounds of frontWindow to {windowLeft, windowTop, windowLeft + defaultWidth, windowTop + defaultHeight}
				set sidebar width of frontWindow to defaultSidebarWidth
				set tBar to toolbar visible of frontWindow
				set toolbar visible of frontWindow to not tBar
				set toolbar visible of frontWindow to tBar
			end try
		end repeat
	end if
end tell

 

 

Place the script in the ~/Library/Scripts/Applications/Finder/ folder and it will be available from the Script menu (if you have it enabled) in the menu bar.

When run, the script will give you the option of resizing just the front Finder window or all open Finder windows and will then size them to the default dimensions specified in the script.

There’s also an option to set different defaults for each individual machine on your network. This assumes that you have set dedicated IP addresses for each machine and it’s connected to your network. You’ll need to change if localIP contains “xxx.xxx.x.xx” then to the appropriate IP address(es) of your machine(s).

NOTE: This is not an original script. I adapted it from one found elsewhere, though I can’t remember where. But I credit the original author, whoever they are!

 

About the author

A native Brit exiled in Japan, Steve spends too much of his time struggling with the Japanese language, dreaming of fish & chips and writing the occasional blog post he hopes others will find helpful.

4 responses

4 Comments

  • Quite annoying sometimes just to open up, resize, rearrange the contents for best view.

    However how about we can make this script to run behind, is that possible. I mean we no need to click on anything. When we open any folder, the script will run and the folder will display as intended. Just my 2cent view.

    • @Kenny

      Good idea, but I’m not sure how you’d do this. A Folder Action or Automator script most likely wouldn’t work. Placing the code between an idle handler and saving the script as a Stay Open Application might work. Maybe I’ll take a look some time.

      Regards, Steve.

  • I see this is dated 2009, does this work for OSX Lion….I hate resizing my finder all the time. Seem to stay in place until reboot…..Thanks

    • Hi John,

      I’m using this script in Lion (10.7.1) on two machines. One was upgraded to Lion the other was a clean install. It’s working fine on both. The dimensions of Finder windows set with this script persist after a re-boot.

      Regards, Steve.

Steve

Recent Comments

Recent Posts