It doesn't seem glamorous, but it is indeed possible to have fun with acpid. acpid is a daemon that sits and listens for acpi events from the kernel. When it gets an event, it fires the rules you have configured.
Okay, so what's the use?