ACPI

ACPI (Advanced Configuration and Power Management Interface) is a power management system. It is part of the BIOS.

Kernel
The following kernel options need to be activated for ACPI:

Software
Desktop environments react on the common events generated by ACPI. If a desktop environment is not installed or to have the system react on special events the ACPI package can be installed. Install the package:

Possible USE flags:

SELinux
For acpid to be able to shutdown a SELinux system, make sure the package is installed and the  executable is re-labelled.

Configuration
The scripts found in define how the system reacts on ACPI events. They can be edited as necessary to meet the user's needs.

Boot service
The acpid service can now be started. While using openrc run:

To have the acpid service start at boot time add it to the default runlevel:

In case of systemd:

Advanced configuration
The default ACPI setup may be satisfactory for some users, however a little extra configuration may be required to get the acpid daemon to treat some basic ACPI events properly (AC power plug in/out, multimedia keys, etc.).

Modifications can be make to along with  if necessary. Why not create a complicated setup that makes use of the and  capabilities? Simply put scripts and event files in those locations for advanced usage.

A basic file will probably be enough for most users, however the following is an example of what could be done using :

Examples
ACPI events and actions examples for Lenovo ThinkPad T410