One-Click Open VSCode Projects with Alfred
Cursor(VSCode) has been used frequently for coding, but opening projects is inefficient. I wanted to create an Alfred Workflow for a one-click VSCode project opening. Research showed that VSCode stores recently opened projects, making this technically feasible.
Screenshots
Download: VSCode-Open Project
Implementation Approach
Database Access
VSCode/Cursor stores recent file/folder history in:
VSCode
$HOME/Library/Application\ Support/Code/User/globalStorage/state.vscdbCursor
$HOME/Library/Application\ Support/Cursor/User/globalStorage/state.vscdb
Note: Application Support
contains spaces, requiring \
escaping in the command line.
Database Query
Use Ruby to query and extract recent project paths from history.recentlyOpenedPathsList
in ItemTable, parsing JSON data with jq.
- Mac has SQLite pre-installed for direct use.
Alfred Format Output
With data extracted, the output follows the Alfred Script Filter format.
Open VSCode/Cursor
Multiple methods:
- URL Scheme
- Command line (
vscode
,cursor
)
URL Scheme was used, and both VSCode and Cursor support it.
Conclusion
This workflow significantly simplifies opening VSCode/Cursor projects.