As an example from the laptop-mode-tools extension: $ cat /etc/acpi/events/lm_lid
event=button[ /]lid
action=/etc/acpi/actions/lm_lid.sh %e
$ cat /etc/acpi/actions/lm_lid.sh
#! /bin/sh
test -f /usr/sbin/laptop_mode || exit 0
# lid button pressed/released event handler
/usr/sbin/laptop_mode auto
Thanks Juanito that helped.
I have used your example and simply modified the action script to echo a message to a test file when the lid is closed/ opened. Sure enough I get messages when the lid is closed or opened. So by installing acpid and creating the files "/etc/acpid/events/lm_lid" and "/etc/acpid/actions/lm_lid.sh" followed by starting acpid ("sudo acpid") I see how I can execute my own script based on the lid.
Now I would like to use the power button and hot keys. How was the file name for the lid event determined. The event is logged as:
button/lid LID 000000xx
and the other buttons are logged as:
button/power PWRF 000000xx
button/sleep SLPB 000000xx
hotkey ATKD 000000xx
xx = a number
edit: after reading the archlinux acpid wiki I see that the events file can handle all events so the name doesn't matter it just needs to exist. All the button script links can be placed in this file.
edit2: Well I'm ready to give up. I can't seem to find an explanation of how acpid event and action file contents work that match my environment. Nothing I've tried other than the lid example works. It's as if no other "key press" is being recognized by acpid.