[email protected] (Joe Nelson), 2019.10.14 (Mon) 04:32 (CEST):
> 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?
 
x-on-resize[1] might help with detecting plug/unplug events of external
monitors.

[1]
https://keithp.com/blogs/x-on-resize/
git://people.freedesktop.org/~keithp/x-on-resize
https://github.com/thedward/x-on-resize
https://marc.info/?l=openbsd-misc&m=148839239518671

Marcus

> 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
> 

Reply via email to