Daily Shaarli

All links of one day in a single page.

August 20, 2025

Cleaning up VSCodium's list of known workspaces

Thanks to rofi launcher and its great rofi-code addition I can open a list of recent workspaces and launch them from rofi.

The down-side is that the list of workspaces can get stale over time, including no longer existing workspaces, etc.

Here's how I usually go about to clean up the list of saved workspaces.

user@host:~
$ cd ~/.config/VSCodium/User/workspaceStorage && vsws_dirname=$(find . -type f -name "workspace.json" -exec dirname {} \;) && \
vsws_content=$(find . -type f -name "workspace.json" -exec awk 'NR==2{print}' {} \;) && \
paste <( printf "%s" "$vsws_dirname" ) <( printf "%s" "$vsws_content" )

There is some repetition, but it's the best I could manage. Was not able to figure out how to get the output of dirname and awk into two columns on the same row using a single find statement.

This gets the path (limited to only the dirname to save space) and the second row of its workspace.json file on the same row.

Example output:

./16fb4bf8cd57e227024b6ded7c39bdb6    "workspace": "file:///chepec/thesis"
./efa86aa09236afc7bd72a99fc93b10e5    "folder": "file:///projects/ansible/roles/dev/remote"
./4bb9a895f505160553890e3f73739cb1    "folder": "file:///backup/luxor/ansible/playbooks/luxor"
./9084209236dc2c220c3759a756343ac4    "folder": "file:///projects/ansible"

We can grep to filter the output to only contain the Codium workspaces/folder that we want to prune, and then delete those folders in one go:

$ cd ~/.config/VSCodium/User/workspaceStorage && \
vsws_dirname=$(find . -type f -name "workspace.json" -exec dirname {} \;) && \
vsws_content=$(find . -type f -name "workspace.json" -exec awk 'NR==2{print}' {} \;) && \
paste <( printf "%s" "$vsws_dirname" ) <( printf "%s" "$vsws_content" ) | \
grep "projects/ansible" | awk '{print $1}' | xargs rm -r --

Verbose, but works nicely.