1
0
Fork 0
Run any command whenever power is plugged in or unplugged.
Datei suchen
mike 7fa026521d noop to test hook 2020-01-02 10:41:25 -08:00
LICENSE Add license 2019-04-26 12:16:18 -07:00
README.md README typo 2019-04-26 12:29:12 -07:00
on-ac-power-state-change Initial script 2019-04-26 12:14:11 -07:00

README.md

On Ac Power State Change

This is a simple script that will run any command you choose, whenever your power state changes (ie: When your laptop power is unplugged or plugged back in). Should run correctly under any user.

Requirements

  • Bash, obviously
  • "logger" should be installed, so this tool can add system logs
  • "acpi" should be installed, so this tool can detect power state changes
    • (only tested with version 1.7)

Usage

Usage is pretty simple. Just pass your custom command as arguments, like so:

$ on-ac-power-state-change echo "Yay this works!"

At that point, you should see the message "Yay this works!" appear in the console whenever your power state changes. This is commonly when a laptop's power cable has been unplugged, or plugged back in.

Cautions

Because this tool will execute any command you provide, it might not be very safe to run as root or an important account unless you know what you're doing.

License

Released under the Mit License