The
acpilid driver supports ACPI “lid switches”. The
powerd(8) daemon can be used to control actions against the events of opening or closing the lid. The script used is
/etc/powerd/scripts/lid_switch, and the events are either
pressed (the lid was closed) or
released (the lid was opened).