I'd like to write a daemon to change machdep.lidaction and the xrandr output as an external monitor or power is attached/detached from my laptop. Is there a way to detect those events from a C program?
Here is how I want the sleep state and output display to change based on whether power is connected, an external monitor is attached, and the laptop is open: Power Mon Open | Sleep Display --------------------------+------------------ x x x | awake both x x | awake external x x | awake laptop x | asleep x x | awake both x | asleep x | awake laptop | asleep -- Joe Nelson https://begriffs.com