Linux laptop protection

A little peace of mind.
Built into your shutdown.

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 disconnect monitoringChoose the power-supply interface to watch.
Configurable grace periodAllow time to reconnect before shutdown.
Independent lid protectionReact to a later open-to-closed lid transition.
What it does

Automatic shutdown protection for Linux laptops.

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.

↯

Watch the power source

Monitor the generic AC interface or select an individual power-supply endpoint, such as a particular USB-C port.

◷

Choose your grace period

Set a delay from 0 to 3600 seconds. If the monitored source reconnects before the timer expires, the countdown is cancelled.

⌑

Respond to lid closure

A lid open-to-closed transition can trigger shutdown immediately, independently of the power countdown.

▣

Stay in control

Use the system tray to start or stop protection, configure settings, inspect logs, and choose whether it starts at boot.

⌘

Use the command line

Status, service control, logs, and diagnostics are also available through the power-guard command.

◈

Separate monitor and GUI

The systemd monitor runs independently. Closing the tray application does not stop protection.

Under the hood

Predictable behaviour, by design.

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.

Arm when 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.

Wait for the grace period

When an armed source disconnects, the countdown begins. Reconnecting the same monitored source cancels it.

Shut down if it stays disconnected

If the countdown expires, Power Guard requests a system shutdown. The lid trigger is monitored separately.

Important: The selected power interface matters. The generic AC interface may report power from any connected input. Selecting an individual port monitors that port, not the physical identity of a particular charger or power bank. Check which interface behaves as intended on your hardware before enabling protection.
Security prerequisite: Power Guard can shut down a laptop without disk encryption, but shutdown alone does not protect data stored on an unencrypted drive. To protect your data if the laptop is lost, stolen, or accessed while powered off, enable full-disk encryption — for example, LUKS2 with dm-crypt, or an equivalent solution. Make sure the encryption unlock credentials are not automatically accessible to someone who obtains the laptop. Power Guard does not enable or manage disk encryption.
Get started

Install Power Guard.

The recommended installation route for Ubuntu is the signed APT repository. Packages for other distributions are available from GitHub Releases.

Ubuntu 24.04 LTS and newer

First, make sure Ubuntu's universe component is enabled. Then add the repository signing key and source:

These commands install the repository key in a dedicated keyring. APT uses it to verify packages from this repository.
TerminalAPT setup
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

Ubuntu / Debian

Use the signed APT repository on supported Ubuntu releases, or download the Debian package directly.

sudo apt install ./power-guard_*.deb

Fedora

Download the noarch RPM package from the latest GitHub Release.

sudo dnf install ./power-guard-*.noarch.rpm

Arch Linux

Download the package archive from the latest GitHub Release.

sudo pacman -U ./power-guard-*.pkg.tar.zst
First-install safety: Installing the package does not automatically start or enable protection. You decide when to activate it.
Everyday use

Protection, your way.

Launch Power Guard from your application menu, or run power-guard-gui. Configure the monitored source and grace period before starting protection.

System tray status

The tray icon gives a quick indication of the monitor state:

  • Green — protection is actively monitoring.
  • Red — protection is stopped or disabled.
  • Grey — status is unknown or unavailable.

Open the tray menu to start or stop protection, change boot enablement, open Settings, or inspect logs.

Command-line controls

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.

The tray GUI and system service are independent. You can quit the GUI while the monitor continues running. Stopping protection releases the lid-switch inhibitor so your desktop's normal lid behaviour resumes.
Open source · Linux

Ready to take a closer look?

Read the documentation, inspect the code, report an issue, or grab the latest release.