Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>VS Code Keep Windows AwakeNew to Visual Studio Code? Get it now.
VS Code Keep Windows Awake

VS Code Keep Windows Awake

jfceb3

|
3 installs
| (0) | Free
Prevents automatic Windows system sleep while VS Code is running, using SetThreadExecutionState rather than simulated keyboard input.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

VS Code Keep Windows Awake

A Windows-only VS Code extension that prevents automatic system sleep while enabled. It calls the native Windows SetThreadExecutionState API through a bundled PowerShell helper. It does not simulate keyboard input and does not change the active Windows power plan.

Requirements

  • To use it: Windows 10/11, VS Code 1.90.0 or later. The helper relies on Windows PowerShell 5.1, which ships with Windows -- nothing extra to install.
  • To build it: Node.js and npm. There are no npm packages to install (no dependencies/devDependencies in package.json); packaging fetches @vscode/vsce on demand via npx.
  • To test it: nothing beyond the above -- the test script runs with Windows PowerShell and does not require administrator rights.

Default behavior

  • Enables automatically after VS Code starts.
  • Prevents automatic system sleep.
  • Allows the display to turn off normally.
  • Shows an Awake status-bar item; click it to toggle.
  • Releases the power request when disabled or when the VS Code extension host exits.

This does not block an explicit Sleep command, shutdown, restart, hibernation initiated by policy, or forced sleep caused by critical battery conditions.

Install

From the Marketplace:

  1. Open VS Code.
  2. Open the Extensions view (Ctrl+Shift+X) and search for jfceb3.vscode-keep-windows-awake, or go to the Marketplace listing and click Install.

From a .vsix (e.g. a GitHub Release):

Repository: github.com/jfceb3/vscode-keep-windows-awake

  1. Open VS Code.
  2. Open the Command Palette with Ctrl+Shift+P.
  3. Run Extensions: Install from VSIX....
  4. Select vscode-keep-windows-awake.vsix.
  5. Reload VS Code if prompted.

Alternatively:

code --install-extension .\vscode-keep-windows-awake.vsix

Commands

  • VS Code Keep Windows Awake: Enable
  • VS Code Keep Windows Awake: Disable
  • VS Code Keep Windows Awake: Toggle
  • VS Code Keep Windows Awake: Show Status

Settings

  • vscodeKeepWindowsAwake.enableOnStartup: enable automatically when VS Code starts. Default: true.
  • vscodeKeepWindowsAwake.keepDisplayOn: also keep the display on. Default: false.
  • vscodeKeepWindowsAwake.showStatusBar: show the status-bar control. Default: true.

Security and privacy

  • No network access.
  • No telemetry or analytics.
  • No simulated keyboard or mouse input.
  • No administrator rights requested.
  • The helper is plain-text PowerShell included in helper/keep-awake.ps1 for inspection.
  • PowerShell is launched with -ExecutionPolicy Bypass for this one helper process; it does not change the machine or user execution policy.

Build from source

npm run package

The .vsix will be created in the project root.

Testing

test/verify-sleep-behavior.ps1 verifies the extension's actual effect on Windows sleep behavior, not just that the helper process runs. It needs an interactive terminal (it pauses for you to toggle the status bar between phases). From Powershell:

.\test\run-test.bat

It temporarily shortens your sleep/display timeouts to 1 minute, walks you through testing both the "Awake" and "Sleep allowed" states, locks the workstation for each, and checks the Windows event log (Microsoft-Windows-Power-Troubleshooter) for an actual sleep event -- expecting none while "Awake" and one while "Sleep allowed". Your original power settings are captured up front and always restored afterward, with the restored values verified against the originals.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft