Ubuntu 20.04虚拟机装Deepin桌面后VS Code自动启动,如何禁用?
Hey there! I get how annoying it is when VS Code pops up automatically every time you boot your Deepin desktop VM. Let’s walk through some straightforward fixes to get rid of this behavior:
Method 1: Tweak VS Code's Built-in Settings
First, check if VS Code itself is configured to restore windows on startup:
- Open VS Code and press
Ctrl+,to open the Settings panel. - In the search bar, type
window.restoreWindows. Change its value fromall(the default) tononeif you don’t want any windows restored, orfoldersif you only want to reopen your project folders (but not the full editor window). - Also search for
startupand look for any option labeled "Open at Login" or similar—make sure this is toggled off.
Method 2: Use Deepin's Startup Applications Manager
Deepin has its own native tool for managing auto-start apps:
- Open the Deepin Launcher and search for Startup Applications (or its localized equivalent if your system isn’t in English).
- In the list of apps, look for an entry named "Visual Studio Code" or "Code". If you find it, either uncheck the box next to it to disable auto-launch, or click the delete button to remove it from the list entirely.
Method 3: Manually Remove Auto-Launch Config Files
If the GUI tool doesn’t work, you can directly edit the system’s auto-start configuration files:
- Open a terminal and check if there’s a VS Code auto-start file in your user-specific config directory:
ls ~/.config/autostart - If you see a file like
code.desktoporvisual-studio-code.desktop, delete it with this command:rm ~/.config/autostart/code.desktop - (Optional) If you don’t find the file in your user directory, check the global auto-start folder (requires sudo access):
If a VS Code entry exists here, delete it using:sudo ls /etc/xdg/autostartsudo rm /etc/xdg/autostart/code.desktop
Method 4: Disable Deepin's Session Restore Feature
Deepin might be restoring your entire previous session (including open apps) on boot:
- Open Deepin’s System Settings and navigate to the Desktop or Session & Startup section.
- Look for an option like "Restore previous session" or "Resume last used applications" and toggle it off.
- Alternatively, make sure to close VS Code properly before shutting down your VM—some desktop environments only restore apps that were open when you logged out or shut down.
If none of these methods resolve the issue, double-check if any VS Code extensions are causing this (though this is rare). You can test this by launching VS Code in safe mode with code --safe-mode; if the auto-launch stops, disable extensions one by one to find the culprit.
内容的提问来源于stack exchange,提问作者Prince Wilson

