Nevermind, I ended up just going with my workaround. I put some timestamps on it and it all happened within a second. I can't argue a second is going to matter in my specific project. The only thing when testing I've found, is that it sometimes finds a false positive and says the monitor is off when it's not. I'm thinking that has to do with me not giving it enough time to write to the text file.
For those of you interested here is what I ended up doing:
Code: Select all
#This is the file where we will write a command line response to,
# in order to look for a substring in later
output_file="/home/pi/your_document.txt"
#xset q gets a complete status of current settings
# write the response to the file we chose
xset q > $output_file
#give time for the file to be written
sleep 1
#After the sleep is complete, we will search for the monitor status
# by looking for a specific string given in the response
if grep -F "Monitor is On" $output_file
then
echo "Monitor status : On"
else
echo "Monitor status: Off"
#Force the monitor back on
xset dpms force on
fi
I just want to clarify this is not equivalent to shutting the monitor off through power, this is to get rid of the screensaver (which I want in my project)