Monthly Shaarli

All links of one month in a single page.

August, 2025

Cleaning up VSCodium's list of known workspaces

Thanks to rofi launcher and its great rofi-code addition I can quickly open a list of VSCodium's recent workspaces and launch one.

The down-side is that the list of workspaces can get stale over time, including no longer existing workspaces or intra-workspace directories opened once by mistake, etc.

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

The first hurdle is to descend into each subdirectory inside ~/.config/VSCodium/User/workspaceStorage/ (usually named with a long non-descript hex string) and extract the path of the workspace or folder from its workspace.json:

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.

shell can pipe concatenated commands, could that help simplify our syntax above? https://michal.sapka.pl/2025/shell-piping-concatenated-commands

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.

Research Software Engineering: A Guide to the Open Source Ecosystem

Authored by Matthias Bannert, published 2024-09-16.

The online version of this book is free to read and licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.