Categories
MacOS / OSX OS/Software Technology

OSX: Setting a global shortcut key to open a new Finder window

Given that the Finder is central to many tasks in Mac OS X, I’m surprised that there is no global keyboard shortcut to call up a new Finder window. Well, that’s not strictly true — there’s alt-cmd-space, which will bring up a new window to start a Spotlight search. But most of the time I want to open my home directory, so I’d rather have a shortcut which jumps straight there.

Googling for the answer to this problem turned up lots of out-of-date suggestions to use Clearsilver and the like, but it seemed to me that a solution could be found using only what OSX provides. And indeed it can. The following has only been tested in 10.6 Snow Leopard.

The basic premise is to create a new Service to perform this task. Because Services are available globally, if you assign a shortcut to one, it should work in any application.

  1. Open the Automator application, and create a new workflow based on the Service template:
  2. In the Library pane, select Utilities, then find the action Run AppleScript and drag it into the workflow:
  3. Replace the line:

    (* Your script goes here *)

    with:

    tell application "Finder"
    activate
    make new Finder window to home
    end tell
  4. Save under the name “New Finder Window Home” or somesuch. Whatever name you choose, make a note of it. Also bear in mind that if you choose a name that matches an existing menu entry in any application, that menu entry will be selected in preference to yours… if you just call it “New Finder Window”, then when Finder is the active application, its own menu entry by that name (in the File menu) will be chosen when you hit the shortcut key combo. It may be that it will have exactly the same effect, but it depends on how you have Finder configured, so to avoid confusion, give it a more specific name.
  5. Go to System Preferences > Keyboard > Keyboard Shortcuts > Application Shortcuts. Click the + button to add a new shortcut:
  6. Enter the exact name that you saved it as earlier (ie New Finder Window Home, if you used the same as me), and your desired shortcut key combo.
  7. It seems you have to quit System Preferences before the shortcut key will become operational. But it’s not necessary to restart other applications.

You can make the new Finder window open to somewhere other than your home directory by replacing home in the AppleScript with, for example, folder "Applications" of startup disk.

20 replies on “OSX: Setting a global shortcut key to open a new Finder window”

One note you should also select “Your service receives NO Input”.
That will make it universally available

Guess what? In OSX it IS in the Library – just not the top level Library or the other Library but the hidden Library. My bad.

Hey, I’m using mountain lion, but the keyboard shortcut doesn’t work after setting it via system preferences!! When I run the script in automator, it works, then the problem seems to be in setting keyboard shortcut?!? any idea?

@thesmarti – that does nothing on my Mac. What version of OSX are you using? I’m using Snow Leopard; maybe they added it later? Also, is it a *GLOBAL* shortcut like mine, or must you have the Finder selected first?

I have the same problem as ToNoY (I’m running 10.8.3): the script works in automator, but the shortcut in system preferences does not. Any suggestions? Thanks!

I’m on mountain lion but I think this should be the same on previous versions. (but not tested)

Under Keyboard shortcuts panel, you don’t need to add an entry to the “Applications shortcuts” tab. When you built the script in Automator, you used the “Service” template, so the script is automatically available in the “Services” tab under the Keyboard shortcuts panel. Look for it, by default it is active, and you just have to add your shortcut on it. Quit the preferences panel and it should work.

This is very helpful. I’m trying to get Finder to open/activate and go to the folder “Downloads.” Thanks to your script, I’m almost there. However, the program doesn’t appear to be able to find the folder. Here’s the program:

on run {input, parameters}

tell application “Finder”
activate
make new Finder window to folder “Downloads”
end tell

return input
end run

and here’s the error message:
Can’t get folder “Downloads”.

I think this may need a path statement in front of downloads, but I couldn’t figure out how to do that. I tried a tilde in front of the folder name, and that didn’t help.

Any help would be much appreciated!

This is great, but I which for one more addition.
When I set this shortcut, it always open in 1 space. So It does not open an finder window in the space i’m currently working in, but it pops up on the space where the first finder window was made. That is really annoying, so anyone has a idea how to fix this?

Well, running the script works. However, the shortcut binding seems to bring up the editor window in Automator for the script, not actually running the script. No idea how to solve that.

Leave a Reply to Tim Harper Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.