While at Newspeak House in 2020 I found myself wanting to change how the screens dotted around the place worked. A little bit of context is needed here. These screens were dotted around the communal areas, each attached to as raspberry pi, and each running a kiosk script to load a browser and website when they first boot up. The code for the screens is on Github, and the pis do not have SSH enabled…

I wanted to change the website that they pointed to. In essence this mean going around and modifying the kiosk script on 6 or so pis using a small bluetooth keyboard and mouse. While doing that, to avoid anyone needing to do it again in the future, I modified the kiosk script to automatically reload itself from Github.

If you don’t know what I mean by kiosk, or how to set it up, you give this post a read.

The main kiosk script uses wget to grab a file from Github, and then run it.

#!/bin/bash wget --retry-on-host-error -O /home/pi/kiosk2.sh raw.githubusercontent.com/nwspk/screens/master/kiosk.sh bash /home/pi/kiosk2.sh
Code language: JavaScript (javascript)

This second kiosk script then runs the actual code to setup kiosk mode.

#!/bin/bash xset s noblank xset s off xset -dpms unclutter -idle 0.5 -root & 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 /usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk https://nwspk.github.io/screens/ & while true; do xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab; sleep 10 done
Code language: PHP (php)

The final piece in this puzzle, which I didn’t end up doing, would be to have the pis restart every evening as part of their setup. Or to have them periodically poll the script, check for changes and reload if needed.