This page explains how to configure the action(s) taken by your system when you press the power button on your PC.

Configure Power Button Action

When the power button is pressed on your PC, the ACPI daemon consults the following file to determine what action to take:

This in turn passes control to:

This script is therefore the best place to configure the action(s) taken when the power button is pressed. For example, in antiX 17.1, the command executed by /etc/acpi/powerbtn-acpi-support.sh is handled by this block of code:

if [ -x /etc/acpi/powerbtn.sh ] ; then
        # Compatibility with old config script from acpid package
        /etc/acpi/powerbtn.sh
elif [ -x /etc/acpi/powerbtn.sh.dpkg-bak ] ; then
        # Compatibility with old config script from acpid package
        # which is still around because it was changed by the admin
        /etc/acpi/powerbtn.sh.dpkg-bak
else
        # Normal handling.
        /sbin/shutdown -h -P now "Power button pressed"
fi 

So, for example, if you want a laptop to sleep rather than shutdown when you press its power button, you would change the final section of this code block to the following:

else
        # Normal handling.
        /usr/sbin/pm-suspend                      
fi 

This change can be effected by editing the file with nano using the following command:

See Also