I needed to teach the product I’m working on about the ACPI power
button, so fired up dbus-monitor –system to see what events I get
when the button is pressed. It was easy to find the device in
question in d-feet afterwards. Unfortunately, the HAL device objects
(/org/freedesktop/Hal/devices/computer_logicaldev_input_N) that emit
the events change between machines and even between reboots, so it’s
necessary to properly discover it.
This little spike solution prints out messages to stdout whenever
certain special ACPI keys on your keyboard are pressed (on my Lenovo
ThinkPad T61, it shows the power button, the volume buttons, the
Fn-key chords for changing backlight, etc.):