From 42a5b3bf22eb6a4f7321fce746e18a51467f088b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Gr=C3=BCndel?= Date: Mon, 20 Oct 2025 23:21:44 +0200 Subject: [PATCH] disable update checks in VS Code on install, now creating target dir first (#2636) Co-authored-by: Ryan Hughes --- bin/omarchy-install-vscode | 2 +- migrations/1760974946.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 migrations/1760974946.sh diff --git a/bin/omarchy-install-vscode b/bin/omarchy-install-vscode index 644a8eb7..9ac4cd5a 100755 --- a/bin/omarchy-install-vscode +++ b/bin/omarchy-install-vscode @@ -3,7 +3,7 @@ echo "Installing VSCode..." omarchy-pkg-add visual-studio-code-bin -mkdir -p ~/.vscode +mkdir -p ~/.vscode ~/.config/Code/User cat > ~/.vscode/argv.json << 'EOF' // This configuration file allows you to pass permanent command line arguments to VS Code. diff --git a/migrations/1760974946.sh b/migrations/1760974946.sh new file mode 100644 index 00000000..ef800abc --- /dev/null +++ b/migrations/1760974946.sh @@ -0,0 +1,21 @@ +echo "Turn off VSCode's own auto-update feature (we rely on pacman)" + +# Note: We cannot use `jq` to update settings.json because it’s JSONC (allows comments), +# which jq doesn’t support. + +VS_CODE_SETTINGS="$HOME/.config/Code/User/settings.json" + +# If VSCode is installed, ensure that the "update.mode" setting is set to "none" +if omarchy-cmd-present code; then + mkdir -p "$(dirname "$VS_CODE_SETTINGS")" + + if [[ ! -f "$VS_CODE_SETTINGS" ]]; then + # If settings.json doesn't exist, create it with just the update.mode setting + printf '{\n "update.mode": "none"\n}\n' > "$VS_CODE_SETTINGS" + elif ! grep -q '"update.mode"' "$VS_CODE_SETTINGS"; then + # Insert "update.mode": "none", immediately after the first "{" + # Use sed's first-match range (0,/{/) to only replace the first "{ + sed -i --follow-symlinks -E '0,/\{/{s/\{/{\ + "update.mode": "none",/}' "$VS_CODE_SETTINGS" + fi +fi