How to take control of macOS Finder window sizes

I don’t know if this is a glitch in my system — I see it in a couple of machines, though both have the same config — but under macOS Catalina, Finder has an annoying habit of ignoring the size of windows. Pop up a new Finder window and it’s just a small quarter-of-screen panel at the top left of the desktop, not the much larger panel that the most recently closed window was.

I’ve tried the key fix you encounter when Googling: drag out the window to the desired size with the Command key down, close the window then restart Finder. But this hasn’t been much help to me. If it works at all, it will break after I reboot or log out.

So I’ve turned to Automator and AppleScript. Here’s what I did:

Open Automator and create a new Quick Action:

Set Workflow receives to No input, and in to Finder. Set the image and colour to your preference:

Select Library > Utilities in the left hand column then drag the Run AppleScript action over to the Quick Action.

Paste in the following code:

on run {input, parameters}
    tell application "Finder"
            set bounds of Finder window 1 to {70, 40, 1350, 870}
        on error
            make Finder window
            set target of Finder window 1 to home
            set bounds of Finder window 1 to {70, 40, 1350, 870}
        end try
    end tell
end run

Change the numeric parameters — which are, respectively, the x and y co-ordinates of the window you want, followed by its width and height — to suit your needs.

The on error block handles cases where there is no window open: it creates a new one, makes it show your home folder then resizes it. There’s scope to refactor the code a little, but it works. The reason I try to set an existing Finder window’s size first is to correct the size of windows I’ve opened using the standard commands and shortcuts.

Finally, save the Quick Action as New Window:

The file will be stored in ~/Library/Services and appear as an option in Finder’s Services sub-menu under General. I’ve quickly got accustomed to opening new Finder windows this way, at then just hitting Command-T for a new tab.

Of course, all this would be unnecessary if Apple gave Finder a default window size you could set at the command line using defaults. I do this with a number of other Finder attributes when I set up a new Mac or nuke and pave an old one. Here’s my set of Finder configuration calls:

defaults write ShowExternalHardDrivesOnDesktop -bool true
defaults write ShowMountedServersOnDesktop -bool true
defaults write ShowRemovableMediaOnDesktop -bool true
defaults write ShowHardDrivesOnDesktop -bool false
defaults write ShowRecentTags -bool false
defaults write ShowStatusBar -bool true
defaults write ShowTabView -bool false
defaults write SidebarDevicesSectionDisclosedState -bool true
defaults write SidebarPlacesSectionDisclosedState -bool true
defaults write SidebarSharedSectionDisclosedState -bool true
defaults write SidebarShowingiCloudDesktop -bool false
defaults write SidebarWidth -int 168
defaults write SidebariCloudDriveSectionDisclosedState -bool true
defaults write WarnOnEmptyTrash -bool false
defaults write _FXShowPosixPathInTitle -bool true
defaults write AnimateInfoPanes -bool false
defaults write AnimateWindowZoom -bool false
defaults write NewWindowTarget -string "PfHm"
defaults write NewWindowTargetPath -string "file://${HOME}"
defaults write FXEnableExtensionChangeWarning -bool false
defaults write FXDefaultSearchScope -string "SCev"

That lot are stored in a text file, which my configuration script loads and executes line by line:

# Run the various macOS config script lets
echo "Configuring macOS… "
if cd "$file_source/Mac/config"; then
    for task in *; do
        echo $task

There are a whole series of defaults for different parts of the system that I also run at the same time; you can view them in my dotfiles repo. Some affect Finder even though they’re not Finder attributes: folder springiness, for example. Others are broader: Dock, mouse, screenshot, TimeMachine and AirDrop settings.