Skip to main content

Disable synchronization of Visual Studio Code keybindings

Overview

About this script

This script improves your privacy on Linux.

These changes use Linux system commands to update your settings.

By default 1, Keyboard Shortcuts are synchronized across platforms 2. You can disable this by setting settingsSync.keybindingsPerPlatform to false 1 2.

This script uses Bash (Shell script) scripting language.

Not Advised

This script should only be used by advanced users. This script is not recommended for daily use as it breaks important functionality. Do not run it without having backups and system snapshots.

Implementation Details
  • Language: bash

  • Required Privileges: Root/sudo access

  • Compatibility: Linux only

  • Reversibility: Can be undone using provided revert script

Explore Categories

This action belongs to Disable data sharing for Visual Studio Code "Settings Sync" category. Settings Sync is a Visual Studio Code feature that synchronizes settings, keybindings, and installed extensions across different machines. This data is stored in the Microsoft Cloud. Read more on category page ▶

Apply now

Choose one of three ways to apply:

  1. Automatically via privacy.sexy: The easiest and safest option.
  2. Manually by downloading: Requires downloading a file.
  3. Manually by copying: Advanced flexibility.

Alternative 1. Apply with Privacy.sexy

privacy.sexy is free and open-source application that lets securely apply this action easily.

Open privacy.sexy

You can fully restore this action (revert back to the original behavior) using the application.

privacy.sexy instructions
  1. Open or download the desktop application
  2. Search for the script name: Disable synchronization of Visual Studio Code keybindings.
  3. Check the script by clicking on the checkbox.
  4. Click on Run button at the bottom of the page.

Alternative 2. Download

Irreversible Changes

This script is irreversible, meaning there is no straightforward method to restore changes once applied. Exercise caution before running, restoring it may not be possible.

  1. Download the script file by clicking on the button below:

    Download script

  2. Run the script file by clicking on it.

Download revert script

This file restores your system to its original state, before this script is applied.

Download restore script

Alternative 3. Copy

This is for advanced users. Consider automatically applying or downloading the script for simpler way.

  1. Open Terminal

  2. Copy the following code:

Code to apply changes
if ! command -v 'python3' &> /dev/null; then
echo 'Skipping because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'settingsSync.keybindingsPerPlatform'
target = json.loads('false')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print('Settings file is empty. Treating it as default empty JSON object.')
file_content = '{}'
json_object = None
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Settings "{property_name}" is not configured.')
else:
existing_value = json_object[property_name]
if existing_value == target:
print(f'Skipping, "{property_name}" is already configured as {json.dumps(target)}.')
continue
print(f'Setting "{property_name}" has unexpected value {json.dumps(existing_value)} that will be changed.')
json_object[property_name] = target
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully configured "{property_name}" to {json.dumps(target)}.')
EOF
fi
  1. Paste the code into terminal.
  2. Press Enter to apply the code.

Some scripts requires restarting your computer to take affect.

Copy restore code

Copy and run the following code to restore changes:

Revert code
if ! command -v 'python3' &> /dev/null; then
>&2 echo 'Cannot revert because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'settingsSync.keybindingsPerPlatform'
target = json.loads('false')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print(f'Skipping, no need to revert because settings file is empty: "{settings_file}".')
continue
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Skipping, "{property_name}" is not configured.')
continue
existing_value = json_object[property_name]
if existing_value != target:
print(f'Skipping, "{property_name}" is configured using {json.dumps(existing_value)} instead of {json.dumps(target)}.')
continue
del json_object[property_name]
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully reverted "{property_name}" setting.')
EOF
fi

Support

This website relies on your support.

Support now

Your donation helps keep the project alive and improves its content ❤️.

Share this page: