1. Install luakit browser and tools
apt-get install xdotool luakit unclutter
2. Get luakit to start automatically when pi boots, disable screensaver/screen blanking
edit /home/pi/.config/lxsession/LXDE-pi/autostart to be like the following:
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash
@xset -dpms
@xset s off
@luakit
3. Create a script for running the kiosk
Create /home/pi/kiosk.sh with the following contents:
#!/bin/bash
sleep 25
export DISPLAY=':0'
WID=`xdotool search --onlyvisible luakit | head -1`
xdotool key --window $WID F11
xdotool type ":o https://www.website1.com/page1.html"
xdotool key Return
xdotool type ":t https://www.website2.com/page2.html"
xdotool key Return
xdotool type ":t https://www.website3.com/page3.html"
xdotool key Return
while true; do
sleep 20
xdotool key Ctrl+Page_Up
xdotool key r
done
This script waits for 25 seconds (for luakit to start after boot) then starts opening tabs for the various sites you want to cycle through. Finally it sends a Ctrl+Page_Up (go to next tab) and F5 (refresh page) every 20 seconds, to cycle through the tabs indefinitely.
Make sure you mark it executable (chmod 744 /home/pi/kiosk.sh)
4. Edit /etc/rc.local so that kiosk.sh runs at startup
/etc/rc.local should look something like the following:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
sudo -u pi /home/pi/start.sh&
exit 0
The key line is
sudo -u pi /home/pi/kiosk.sh&
which starts our kiosk as the pi user
Reboot and you're done!
No comments:
Post a Comment