Skip to content

ACPI utilities for use in scripts and one-liners

License

Notifications You must be signed in to change notification settings

jirutka/acpi-utils

Repository files navigation

ACPI utils

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'

Usage

Refer to the manual pages for usage information and more examples:

Requirements

  • POSIX-sh compatible shell (e.g. Busybox ash, dash, ZSH, bash, …)

  • cat, sed, test, tr (BSD, Busybox or GNU)

Installation

On Alpine Linux

Install package acpi-utils from the Alpine’s Edge community repository:

apk add acpi-utils

From Tarball

wget https://github.com/jirutka/acpi-utils/archive/v0.1.0/acpi-utils-0.1.0.tar.gz
tar -xzf acpi-utils-0.1.0.tar.gz
cd acpi-utils-0.1.0
make install DESTDIR=/ prefix=/usr/local

…​or just download the scripts directly.

License

This project is licensed under MIT License. For the full text of the license, see the LICENSE file.