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"
        try
            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 com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowRecentTags -bool false
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder ShowTabView -bool false
defaults write com.apple.finder SidebarDevicesSectionDisclosedState -bool true
defaults write com.apple.finder SidebarPlacesSectionDisclosedState -bool true
defaults write com.apple.finder SidebarSharedSectionDisclosedState -bool true
defaults write com.apple.finder SidebarShowingiCloudDesktop -bool false
defaults write com.apple.finder SidebarWidth -int 168
defaults write com.apple.finder SidebariCloudDriveSectionDisclosedState -bool true
defaults write com.apple.finder WarnOnEmptyTrash -bool false
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
defaults write com.apple.finder AnimateInfoPanes -bool false
defaults write com.apple.finder AnimateWindowZoom -bool false
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
defaults write com.apple.finder 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
        ./$task
    done
fi

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s