Brad Fitzpatrick (brad) wrote in linux,
Brad Fitzpatrick

Detecting Monitor State

I want to programmatically detect the state of my monitor. I had assumed that xset q would tell me "Monitor is Off" when I turned it off, but sadly, it doesn't... it only tells me "Monitor is Off" when I log into a box remotely and do xset dpms force off and then check xset q. So basically, it only reports the last state you've told it to go into, or the state it's forced itself into as a result of a time delay. It doesn't actually report the state from the device.

Are there any other options?

Surely the video card knows when the signal it's generating isn't being consumed. I thought that was an FCC requirement, analogous to how sound cards don't generate a signal if there's no wire plugged in.

So assuming the video card knows, is this info available anywhere? Does the XFree86 driver feed it to any place inside X that I can query?

For the curious, I have a spare-ish computer running a monitor up in the corner of my room. When I turn the monitor off I want my slideshow application to pause so 1) it frees CPU for other tasks I occasionally run on the box, and 2) resumes the slideshow where it left off.

Sure, I could pause the app from over the network, but that's kinda inconvenient, especially when all the interface I need (a big plastic button) is already present.
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded