Skip to content

Instantly share code, notes, and snippets.

@ilessing
Last active April 8, 2023 15:50
Show Gist options
  • Save ilessing/be970dae7ab0c3d4b4a3a796414100b7 to your computer and use it in GitHub Desktop.
Save ilessing/be970dae7ab0c3d4b4a3a796414100b7 to your computer and use it in GitHub Desktop.
a one line shell / applescript to open VS Code in current Finder window

Have you ever been tooling through your file system in Finder and you get to a directory where you would like to open VScode to edit the files there.
You could grab the proxy icon and drag it to the VScode icon on your Dock or you could go up one directory and then drag the folder icon to the dock and there are probably other ways.

But I wanted to be able to do this with a single button press on my Streamdeck.
So I made this one line shell script and wired it to a Streamdeck button:

/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code $(osascript -e 'tell application "Finder" to return POSIX path of (target of front Finder window as text)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment