Configure action when power-button is pressed
This article explains how to configure what happens when you press the power button. This might be useful to allow for desktop environments to control what happens instead of shutting down.
- Install acpid:
# apk add acpid
- Enable and start the acpid daemon:
# rc-update add acpid && rc-service acpid start
Busybox acpid
This can be done via Busybox acpid by creating/modifying the hook in /etc/acpi/PWRF/00000080.
Configuring for shutdown
In a newly installed system this might be already defined, however you can create the hook as follows:
Contents of /etc/acpi/PWRF/00000080
#!/bin/sh
poweroff
Configuring for sleep
- Install zzz:
# apk add zzz
- Modify the hook as follows:
Contents of /etc/acpi/PWRF/00000080
#!/bin/sh zzz
Disabling
To disable simply comment or remove the hook. This is useful to allow desktop environments to handle the power button.
Contents of /etc/acpi/PWRF/00000080
#!/bin/sh
#Nothing