Lock Guard
Lock guard is a background process that shuts down a computer when its locked and unplugged. It was designed with hyprland in mind, but it should work on all desktop environments where the lock screen is a executable.
Why?
Sometimes the need arises to leave your computer at your desk, locking it provides some safety but its not the best. A device with full disk encryption will always be safest while powered off. The scenario this is ment to protect against is something like this.
- Your computer is at your desk, plugged in.
- You lock your computer because you need to leave it temporarily.
- A bad actor enters the space where your computer is and takes it.
- They exploit the io. This could be something like connecting the device to a wired network and sniffing the traffic.
With this, when the laptop is disconnected from the wall it will turn off. This will cause the computer to return to a more secure state.
If you are on the go, and not connected to power then this program will do nothing.
Installation
You can easily install with cargo
cargo install lock-guard
or
cargo binstall lock-guard
Configuration
Configuration is handled through the cli.
> lock-guard
)
Battery selection
You can find your battery by running
ls /sys/class/power_supply/
Its usually named BAT1
Setting --battery to DISABLED will disable the program. This is here to support dotfile variable substitution. This is for when your dotfiles needs to work on both desktops and laptops.
Desktop enviroment - Hyprland
hyprland.conf
exec-once = lock-guard --poll-rate 0.5 -l hyprlock,swaylock --delay 5 --battery BAT1