Post by Rich Post by Mike Post by Rich
... whether or not the monitor is turned on?
it is possible that "xset q" will tell you what you want.
Standby: 600 Suspend: 600 Off: 600 DPMS is Enabled Monitor
Note the "Monitor is On" line.
It is possible it will lie to you too :(
Maybe this is only querying whether the computer thinks the monitor
should be active/blanked/part sleeped/deep sleeped,
rather than interrogating the monitor to find if the power is on.
What it tells you is whether X has used the DPMS signalling to instruct
the monitor to turn itself off.
If you are looking for it being physically turned on/off, then this
method will not help detect that fact.
Many years ago, before Xorg was able to automagically select the right
resolution for your monitor (maybe this was on the XFree86 days) you had
to edit your Xorg.conf or xfree86.conf to add modelines which matched
your monitor. Somehow I was able to automate this during install calling
some program which queried the monitors capabilities using dpms and then
added the needed modelines to xorg.conf. Once xorg.conf fixed this
automagically I no longer needed this in my custom installation scripts
and I have now forgotten what the name of the program was.
A similar program is dmidecode, but that was not the tool used to query
My guess is that the program querying the monitor for resolutions will
only work if the monitor is on.
Maybe the command was xcmddc, but then possibly it only did work with