Programmatically detect monitor
I'm trying to detect when the user plugged / unplugged his monitor.
I've used the code from nvidia settings, and I'm able to detect a monitor plug / unplug with NV_CTRL_PROBE_DISPLAY, but I have to run a loop for this, and this is not possible in my application.
The issue with polling that way, is that unless my application does this 100% of the time, I can miss one event (unplug & plug).
I wonder if it's possible to get a X event on such detection, instead of probing in loop ?
Ideally, the event should be timestamp'd so the application can react afterward with never loosing such detection.