#!/bin/bash
CAPTURE_FILE=/tmp/xset.txt
echo $CAPTURE_FILE

echo 'xset status' > $CAPTURE_FILE 2>&1
xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

#echo -e '\n\n################\nsetting dpms on\n################' >> $CAPTURE_FILE 2>&1
#xset +dpms >> $CAPTURE_FILE 2>&1
#echo 'xset status' >> $CAPTURE_FILE 2>&1
#xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
#xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

#echo -e '\n\n################\nsetting dpms off\n################' >> $CAPTURE_FILE 2>&1
#xset -dpms >> $CAPTURE_FILE 2>&1
#echo 'xset status' >> $CAPTURE_FILE 2>&1
#xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
#xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

echo -e '\n\n################\nset screensaver noblank\n################' >> $CAPTURE_FILE  2>&1
xset s noblank >> $CAPTURE_FILE 2>&1
echo 'xset status' >> $CAPTURE_FILE 2>&1
xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

#echo -e '\n\n################\nshutting screensaver off\n################' >> $CAPTURE_FILE  2>&1
#xset s off >> $CAPTURE_FILE 2>&1
#echo 'xset status' >> $CAPTURE_FILE 2>&1
#xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
#xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

echo -e '\n\n################\nshutting off monitor\n################' >> $CAPTURE_FILE 2>&1
xset dpms force off >> $CAPTURE_FILE 2>&1
echo 'xset status' >> $CAPTURE_FILE 2>&1
xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

echo -e '\n\n################\nsleeping for 3 seconds\n################' >> $CAPTURE_FILE 2>&1
sleep 3s

echo -e '\n\n################\nreseting screensaver\n################' >> $CAPTURE_FILE  2>&1
xset s reset >> $CAPTURE_FILE 2>&1
echo 'xset status' >> $CAPTURE_FILE 2>&1
xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

echo -e '\n\n################\nset screensaver blank\n################' >> $CAPTURE_FILE  2>&1
xset s blank >> $CAPTURE_FILE 2>&1
echo 'xset status' >> $CAPTURE_FILE 2>&1
xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

echo -e '\n\n################\nshutting off monitor\n################' >> $CAPTURE_FILE 2>&1
xset dpms force off >> $CAPTURE_FILE 2>&1
echo 'xset status' >> $CAPTURE_FILE 2>&1
xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

echo -e '\n\n################\nsleeping for 3 seconds\n################' >> $CAPTURE_FILE 2>&1
sleep 3s

echo -e '\n\n################\n\activating screensaver on\n################' >> $CAPTURE_FILE  2>&1
xset s activate >> $CAPTURE_FILE 2>&1
echo 'xset status' >> $CAPTURE_FILE 2>&1
xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

#echo -e '\n\n################\nshutting screensaver on\n################' >> $CAPTURE_FILE  2>&1
#xset s on >> $CAPTURE_FILE 2>&1
#echo 'xset status' >> $CAPTURE_FILE 2>&1
#xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
#xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

#echo -e '\n\n################\nset screensaver noblank\n################' >> $CAPTURE_FILE  2>&1
#xset s noblank >> $CAPTURE_FILE 2>&1
#echo 'xset status' >> $CAPTURE_FILE 2>&1
#xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
#xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

#echo -e '\n\n################\nturning monitor back on\n################' >> $CAPTURE_FILE 2>&1
#xset dpms force on >> $CAPTURE_FILE
#echo 'xset status' >> $CAPTURE_FILE 2>&1
#xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
#xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

#echo -e '\n\n################\nsleeping for 3 seconds\n################' >> $CAPTURE_FILE 2>&1
#sleep 3s

#echo -e '\n\n################\nreseting screensaver\n################' >> $CAPTURE_FILE  2>&1
#xset s reset >> $CAPTURE_FILE 2>&1
#echo 'xset status' >> $CAPTURE_FILE 2>&1
#xset -q | grep -A1 DPMS >> $CAPTURE_FILE  2>&1
#xset -q | grep -A2 Screen >> $CAPTURE_FILE  2>&1

cat $CAPTURE_FILE

