Watch the power source
Monitor the generic AC interface or select an individual power-supply endpoint, such as a particular USB-C port.
Power Guard is open-source Linux laptop power protection software. It watches your selected power connection and lid, and can automatically shut down your computer if that power source disconnects or the lid closes — helping protect a laptop that shouldn't be left running unattended.
Current release: v0.1.5 · Open source · Linux
Power Guard combines a lightweight desktop tray application with an independent system service. Configure it once, then let the monitor do its job in the background.
Monitor the generic AC interface or select an individual power-supply endpoint, such as a particular USB-C port.
Set a delay from 0 to 3600 seconds. If the monitored source reconnects before the timer expires, the countdown is cancelled.
A lid open-to-closed transition can trigger shutdown immediately, independently of the power countdown.
Use the system tray to start or stop protection, configure settings, inspect logs, and choose whether it starts at boot.
Status, service control, logs, and diagnostics are also available through the power-guard command.
The systemd monitor runs independently. Closing the tray application does not stop protection.
Power Guard avoids treating every boot on battery as an emergency. The power trigger is armed only after the selected source has been detected as connected.
If the selected power source is connected at boot, monitoring is armed. If the laptop boots on battery, the power trigger stays disarmed until that source is connected.
When an armed source disconnects, the countdown begins. Reconnecting the same monitored source cancels it.
If the countdown expires, Power Guard requests a system shutdown. The lid trigger is monitored separately.
The recommended installation route for Ubuntu is the signed APT repository. Packages for other distributions are available from GitHub Releases.
First, make sure Ubuntu's universe component is enabled. Then add the repository signing key and source:
sudo install -d -m 0755 /usr/share/keyrings
curl -fsSL https://power-guard.eth0.cloud/public.key \
| sudo gpg --dearmor --yes -o /usr/share/keyrings/power-guard-archive-keyring.gpg
sudo tee /etc/apt/sources.list.d/power-guard.sources >/dev/null <<'EOF'
Types: deb
URIs: https://power-guard.eth0.cloud/
Suites: stable
Components: main
Signed-By: /usr/share/keyrings/power-guard-archive-keyring.gpg
EOF
sudo apt update
sudo apt install power-guard
Use the signed APT repository on supported Ubuntu releases, or download the Debian package directly.
sudo apt install ./power-guard_*.debDownload the noarch RPM package from the latest GitHub Release.
sudo dnf install ./power-guard-*.noarch.rpmDownload the package archive from the latest GitHub Release.
sudo pacman -U ./power-guard-*.pkg.tar.zstLaunch Power Guard from your application menu, or run power-guard-gui. Configure the monitored source and grace period before starting protection.
The tray icon gives a quick indication of the monitor state:
Open the tray menu to start or stop protection, change boot enablement, open Settings, or inspect logs.
Prefer a terminal? The CLI provides the same core service controls:
power-guard status
power-guard enable
power-guard disable
power-guard start
power-guard stop
power-guard restart
power-guard logs
power-guard doctor
Enabling controls whether protection starts at boot. Starting controls the service immediately. They are separate actions.
Read the documentation, inspect the code, report an issue, or grab the latest release.