An Alfred workflow for opening your projects.
- Install the workflow. Either download it from GitHub or follow the instructions below to build it yourself. Then, double-click the
Project Picker.alfredworkflow
file to install it. - Create a
project-picker.json
file in the~/.config
folder (make sure to create the folder if it doesn’t exist). See the Configuration section below for what to put into it
The project-picker.json
config file should have two top-level keys:
searchPaths
: An array of folders to search for project folders in, relative to your home directory. Any folders listed here will not be available from Alfred. (for example, mysearchPaths
includesDocuments/github-clones
). Search paths are not recursive — only folders directly inside of a search path will be counted as projects.apps
: The names of apps to launch. This must be an object with all of the following keys:default
: The name of the app to launch if the type of a given project could not be detectedxcode
: The name of the app to launch for projects with a*.xcodeproj
,*.xcworkspace
, orPackage.swift
file (such as"Xcode"
or"Xcode-beta"
)vscode
: The name of the app to launch for projects with a*.code-workspace
file (such as"Visual Studio Code"
)qtCreator
: The name of the app to launch for projects with a*.pro
file (such as"Qt Creator"
)
For more details on how the editor lookup works, check out the Project.Kind.infer(from:)
method in Project.swift
.
After highlighting a project in Alfred, you can do the following things:
- Press return to open the project in the appropriate editor
- Press ⌘+return to open the project folder in the Finder
- Press ⌥+return to open the project folder in Terminal
- Press 🌐︎+return to open the project in GitHub Desktop
- Press ⌃ to perform actions on the project folder using Alfred
With Xcode and the developer tools installed (xcode-select --install
), run ./build.sh
. This will do the following tasks:
- Build the binary in release mode, and place it inside of the
workflow
directory - Code-sign the resulting binary so it can run
- Create the
Project Picker.alfredworkflow
file by zipping up the contents of theworkflow
directory - Notarize the resulting
Project Picker.alfredworkflow
file, and wait for it to finish.
The script may need tweaking, especially in the code signing and notarization steps, for your exact developer setup.
I’d live to make this tool even more customizable. Feel free to open PRs adding options for new categories of editor, and support for other editors that don’t work with the current “open with” technique. I think it would also be neat to add support for customizing the terminal / file browser.