AwakeScreen
AwakeScreen is a lightweight VS Code Desktop extension that temporarily prevents display sleep and idle sleep while you explicitly keep it enabled.
Quick start
- Open VS Code Desktop.
- Enable Keep Awake from the status bar or run
Keep Awake: Toggle from the Command Palette.
- Wait until the status bar indicates that Keep Awake is active.
- Disable it from the status bar or run
Keep Awake: Disable when you no longer need sleep prevention.
Features
- One-click sleep prevention from the VS Code status bar
- Three commands for toggle, explicit enable, and explicit disable flows
- Optional automatic activation when VS Code starts
- OS-specific sleep prevention on Windows, macOS, and Linux without permanently changing power settings
- Warning state with retry when sleep prevention could not start
Commands
Keep Awake: Toggle
Keep Awake: Enable
Keep Awake: Disable
⚙️ Settings
| Setting |
Default |
Description |
awake-screen.enableOnStartup |
false |
Automatically enable Keep Awake when VS Code starts or a window reloads. |
Enable AwakeScreen: Enable On Startup in VS Code user settings, or add this to your user settings.json:
{
"awake-screen.enableOnStartup": true
}
Changes apply the next time the extension starts; restart VS Code or reload the window to apply them. This is a user setting shared across windows and cannot be overridden by workspace settings. With the default false, Keep Awake remains off at startup. With true, you can still disable it manually after startup, and it will be enabled again on the next startup or window reload. Startup failures use the same warning state and error notification as manual activation.
Status bar states
The status bar always shows the Keep Awake status in one of four ways:
- Off, when sleep prevention is disabled
- Starting, while activation is in progress
- Active, while sleep prevention is running
- Warning, when startup failed and a retry is available
Supported environments
- Windows: uses a hidden PowerShell helper that periodically calls
SetThreadExecutionState
- macOS: uses
caffeinate -d -i
- Linux: uses
systemd-inhibit --what=idle:sleep
- VS Code for Web, github.dev, and vscode.dev are out of scope
- Remote SSH, WSL, and Dev Containers are supported only through the local VS Code UI side
Limitations
This extension does not prevent manual sleep, screen lock, lid close, power button actions, or organization-enforced power policies. It does not change OS power settings permanently, requires no administrator privileges, and does not rely on a separate Node.js installation on the user machine.
If the required OS command or API path is unavailable, Keep Awake moves to the warning state and shows an error notification. On Linux, environments without systemd-inhibit are not supported.
License
MIT