Turning On/Off Monitor Raspberry Pi Scripts

You can use these scripts to turn on/off monitor of raspberry pi

screen_off.sh:
#!/bin/sh
tvservice --off > /dev/null

screen_on.sh:
#!/bin/sh
export DISPLAY=:0
tvservice -p
fbset -depth 8; fbset -depth 16; xrefresh

Another option (this is failed when tested because apt-get doesnt found cec-util package):

apt-get install cec-util

# Screen on, change to the active input of the Pi

echo "on 0" | cec-client -s > /dev/null
sleep 5
echo "as" | cec-client -s > /dev/null

#Screen off
echo "standby 0" | cec-client -s

Source:
– https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/

Raspberry Pi Kiosk Mode

To make Raspberry Pi automatically run specific app (browser) — kiosk mode, first install:

apt-get install x11-xserver-utils
apt-get install xscreensaver

Then edit this file:

/etc/xdg/lxsession/LXDE/autostart (on newer raspbian this is LXDE changed to LXDE-pi)
@lxpanel --profile LXDE

@pcmanfm --desktop --profile LXDE
#@xscreensaver -no-splash
#run midori
#@midori -e Fullscreen
#or run chromium
@chromium --kiosk http://localhost/dashboard
@xset s noblank
@xset s off
@xset -dpms

Notes:
– Check if the file /home/pi/.config/lxsession/LXDE-pi/autostart file exists. If it exists, it will be used instead of /etc/xdg/lxsession/LXDE-pi/autostart
– View logs (after reboot) in /home/pi/.xsession-errors

You can also change this file to disable screen blank when LXDE not running (terminal mode):

/etc/kbd/config
BLANK_TIME=0
BLANK_DPMS=off
POWERDOWN_TIME=0

And this to disable screen blank in LXDE:

/etc/lightdm/lightdm.conf
[SeatDefaults]
xserver-command=X -s 0 -dpms

Source:
– https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/
– http://raspberrypi.stackexchange.com/questions/42633/raspberry-pi-autostart-of-lxde-does-not-work