A VS Code extension that monitors your battery level and alerts you when it falls below a configurable threshold.
Features
Battery Monitoring: Automatically checks your battery level at regular intervals
Low Battery Alerts: Shows a warning notification when battery drops below the threshold
Status Bar Display: Shows current battery percentage in the status bar
Configurable Settings: Customize threshold and check interval
Cross-Platform: Works on macOS, Windows, and Linux
Commands
Battery Alert: Check Battery Now - Manually check the battery level
Battery Alert: Show Battery Status - Display current battery status
Extension Settings
This extension contributes the following settings:
Setting
Default
Description
batteryAlert.threshold
20
Battery percentage threshold below which to show an alert (5-100)
batteryAlert.checkInterval
60
How often to check the battery level in seconds (10-600)
batteryAlert.enabled
true
Enable or disable battery alerts
Alert Frequency
Alerts fire at most once per 5% drop — so you'll be notified at 20%, 15%, 10%, and 5% (or whatever bands fall at or below your threshold). If VS Code starts while the battery is already mid-band (e.g. 14%), the alert still fires immediately since that value has crossed the nearest 5% boundary (15%). Plugging in resets the tracking so alerts resume correctly on the next discharge cycle.
How It Works
The extension uses native system commands to check battery status:
macOS: Uses pmset -g batt
Windows: Uses WMIC to query Win32_Battery
Linux: Uses upower or reads from /sys/class/power_supply/