Opening Downloads folder with Alfred app on a Mac

Alfred app
Tools
howto
Author

Alejandro Soto

Published

October 10, 2021

Note

Assumed Audience: Anyone who uses the Alfred App as part of their productivity workflow on a Mac.

I use the Alfred App to improve my interactions with my Mac. In particular, I have been trying to really leverage the ability to create “workflows” in Alfred in order to streamline my work and remove annoyances. One annoyance that I have recently solved with an Alfred workflow: opening the Downloads folder in different desktops.

I use virtual desktops on my Macs, usually no more than a dozen, to organize the software that I am using. For example, I have a dedicated virtual desktop just for my work email. The only clutter on that virtual desktop are emails, and it isn’t really clutter when I am on that desktop, focused on my email. I also have separate desktops for calendars and work “social” apps (e.g., Slack, Microsoft teams, etc.). And finally, I have separate desktops for my projects.

Often, I want to open the downloads folder, ~/Downloads. I can use Alfred to open the Downloads folder, by just typing in downloads in the Alfred window and picking the right folder.

However, if I already have the Downloads folder open in another desktop for some other reason, then macOS won’t open a new folder in the current desktop, but instead move me to the desktop with the pre-existing finder window with Downloads open. I find this very annoying. Instead, I want to just create a brand new Finder window open to Downloads, right there, in the virtual desktop I already am in.

Fortunately, I can create a workflow to do this. First, I create a blank workflow. Then I add a keyword input, which allows me to type a short-code (in my case, ‘dl’) to start the workflow. I then connect the keyword input to an action. In this case, the action is “Run NSAppleScript”. This action will then execute an AppleScript program that I put in the action.

Now, the tricky part is telling AppleScript to open a new finder window in the Downloads folder instead of just going to any existing Downloads folder. Fortunately, some other people had figured this out for me. From iTecTec and from MacScripter I have the following script:

on alfred_script(q)

set myTarget to ((path to downloads folder) as text)

tell application "Finder" to make new Finder window to folder myTarget

end alfred_script

So far this works beautifully.