acpi-utils provides small utilities for properties of the power supply devices and the (laptop) lid. They are designed for easy use in scripts and one-liners for e.g. conditional execution of commands when specified conditions are met.
For example, it can be used with swayidle to suspend the computer after 10 minutes of inactivity if running on battery (i.e. AC adapter is unplugged):
swayidle \
timeout 300 'swaylockd' \
timeout 600 'power-supply -d ac -s offline -- doas zzz'
Refer to the manual pages for usage information and more examples:
-
POSIX-sh compatible shell (e.g. Busybox ash, dash, ZSH, bash, …)
-
cat
,sed
,test
,tr
(BSD, Busybox or GNU)
Install package acpi-utils from the Alpine’s Edge community repository:
apk add acpi-utils
This project is licensed under MIT License. For the full text of the license, see the LICENSE file.