Setup Raspberry pi with TFT in kiosk mode

Install rasbian lite

Updated and upgrade sw

> sudo apt update
> sudo apt upgrade
> sudo apt dist-upgrade

Add xserver support

> sudo apt install lxde lxde-core lxterminal lxappearance

Configure kiosk mode

Setup Auto Login

The Raspberry Pi should auto log in by default, but if not you can check the setting for that by running sudo nano /etc/lightdm/lightdm.conf and looking for:

[SeatDefaults]
 
autologin-user=pi

Then we need to create the auto login task which will run the script. Run nano /home/pi/.config/autostart/kiosk.desktop and add:

[Desktop Entry]
Type=Application
Name=Kiosk
Exec=/home/pi/kiosk.sh
X-GNOME-Autostart-enabled=true

Setup the kiosk.sh script

Now we need to setup the script which will run once we’re logged in. Run nano /home/pi/kiosk.sh and add:

#!/bin/bash
 
# Run this script in display 0 - the monitor
export DISPLAY=:0
 
# Hide the mouse from the display
unclutter &
 
# If Chrome crashes (usually due to rebooting), clear the crash flag so we don't have the annoying warning bar
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences
 
# Run Chromium and open tabs
/usr/bin/chromium-browser --window-size=480,320 --kiosk --window-position=0,0 https://google.com https://bing.com &
 
# Start the kiosk loop. This keystroke changes the Chromium tab
# To have just anti-idle, use this line instead:
# xdotool keydown ctrl; xdotool keyup ctrl;
# Otherwise, the ctrl+Tab is designed to switch tabs in Chrome
# #
while (true)
 do
  xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab;
  sleep 15
done

Then make the script executable by running chmod +x kiosk.sh

As you can see Chromium runs in Kiosk mode. This means it’ll go full screen and take minimal input from the keyboard and mouse (if one was plugged in). In this example, Chromium will auto load Google and Bing in 2 tabs, and xdotool will cycle between the tabs every 15 seconds. I’m also performing some Chrome clean up in case the system reboots without closing Chrome. This will remove the nag bar.

Disable screen blanking in X

add the following lines to /etc/xdg/lxsession/LXDE/autostart

@xset s noblank
@xset s off
@xset -dpms

Don't be such an angerball