Table of Contents
This is just a very brief blog post inspired by Andrew Heiss. I have been using the same setup for a while (Project Manager extension + Raycast), but I decided to move to Alfred completely at one point. However Alfred didn't seem to have another simple workflow like Raycast do, they were either script-based, or did not work exactly as the Raycast one. Digging through Alfred's documentation I found out that it is possible to create a custom workflow to open VS Code workspace files with specific app(s), by using Alfred built-in actions. I had been using this for a while, but only after seeing the above blog post I though maybe it was worth sharing.
Also, note that Positron docs do mention a way to open projects in MacOS, but they mostly talk about Raycast and mention Alfred only in relation with Rstudio files (which make also sense, since you cannot account for every custom workflow that people might have)
Download the workflow#
If you want to skip the manual setup and just download the workflow with my defaults (they are modifiable anyway), you can find it on Codeberg. The repo has also a README file with some more details on the installation and customization procedure.
Note: you need to have Alfred Powerpack to use this workflow (or any workflow).
Manual setup#
Note: I put some docs here and there but don't consider this a proper tutorial, also if you want to learn more about Alfred Workflows you can check their documentation.
New workflow and file filter#
- Open Alfred's Preferences
- Go to the Workflows tab
- Click on the
+button and selectBlank Workflow- Give it a name and a description, and an icon if you want
- Right-click on the canvas and select
Input>File Filter(Docs)
- Decide on a keyword and if you want some placeholder title and subtitle text (you can use {query} to show the current query in the title)
- Now you need to select a file type, honestly I have no idea how to get UTIs, so the easiest option is just to drag and drop any
.code-workspacefile on the canvas, and Alfred should automatically detect it.
- Move to the
scopetab and click on the+button to add a new folder. This is the folder Alfred will look for the.code-workspacefiles in. You can add multiple folders I think, but I just put the home folder there.
- Hit
Save
File actions#
- Right-click on the canvas and select
Actions>Open File(Docs)
- Drag and drop the app you want to open the file with. In this case, you can drag and drop the Positron app from the Applications folder, and hit
Save.
- Repeat the steps for the other app you want to open the file with. In this case, I also added VSCodium and VSCode.
- Bonus: right-click on the canvas and select
Actions>Reveal File in Finder(Docs) to add a quick action to reveal the folder where the .code-workspace file is located. - IMPORTANT: Connect the
File Filterto theOpen Fileactions by dragging and dropping from the right "notch" of theFile Filterto the left "notch" that will appear of theOpen Fileactions. You can connect all the actions to the sameFile Filter.
Actions Modifiers#
Now in order to open the file with a specific app, you need to add an action modifier:
- Click on the circle on the connection line between the
File Filterand theOpen Fileaction. - Toggle the modifier key that you want to use to open the file with the specific app. In this case, I used none for VSCodium (meaning I just need to press
Enterto open the file with VSCodium),Commandfor Positron,Shiftfor VSCode, andOptionfor theReveal File in Finderaction. You can also add a subtext to actually see what you are doing.
Bonus - Hotkey#
If you don't want to type the keyword every time, you can also add a hotkey to the workflow, so that you can just press a key combination to open the workflow. To do so:
- Right-click on the canvas and select
Triggers>Hotkey. (Docs) - Type your hotkey into the box that appears.
- Leave
actionfield asShow Alfred. - In the
argumentfield, you can either type the keyword or use a variable to pass the selected file to the workflow. Note: you can also just usenoneand the workflow will open with the Alfred box and you can just start typing to search for projects.