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.alfredworkflowfile to install it. - Create a
project-picker.jsonfile in the~/.configfolder (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, mysearchPathsincludesDocuments/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.swiftfile (such as"Xcode"or"Xcode-beta")vscode: The name of the app to launch for projects with a*.code-workspacefile (such as"Visual Studio Code")qtCreator: The name of the app to launch for projects with a*.profile (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
workflowdirectory - Code-sign the resulting binary so it can run
- Create the
Project Picker.alfredworkflowfile by zipping up the contents of theworkflowdirectory - Notarize the resulting
Project Picker.alfredworkflowfile, 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.