Skip to content

Instantly share code, notes, and snippets.

@Kuxe
Last active October 6, 2022 00:03
Show Gist options
  • Save Kuxe/976d4765ee520c88d336fa1fefe01dc6 to your computer and use it in GitHub Desktop.
Save Kuxe/976d4765ee520c88d336fa1fefe01dc6 to your computer and use it in GitHub Desktop.
A script that allows you to open workspaces in Code - OSS via rofi, e.g: "rofi -modes drun,window,code-workspaces:~/bin/code-workspaces.sh -show drun". You need ripgrep and awk available in $PATH.
#!/bin/bash
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
if [ $# -eq 0 ]
then
pushd ~/.config/Code\ -\ OSS/User/workspaceStorage && rg ".code-workspace" | awk '{print substr($3,9,length($3)-24);}' | sort && popd
else
WORKSPACEFILE="$1"
WORKSPACEEXTENSION=".code-workspace"
FULLWORKSPACEFILE="$WORKSPACEFILE$WORKSPACEEXTENSION"
code $FULLWORKSPACEFILE > /dev/null
fi
@Coffelius
Copy link

very good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment