So I have this project of linking together two machines. As I didn't want to relay on the router for local network and to control the central Rpi through the network with a tablet I decided two buy the official Rpi touchscreen and the superb Smartipi Pro case. Thus I needed the Rpi to function in kiosk mode. Here is the writeup of what I did. This has worked for me but I don't pretend that it is the right way to do it. Details have been copied from various sources.
I have Rpi 3 B with the Raspberry Pi OS with desktop and recommended software
downloaded from the official site and Node-red installed with the install script.
An opinion on text editing
Using nano is possible, but I personally prefer to use SFTP to log into the target machine (using Cyberduck or FileZilla), so I have a good overview of file structure and locations. Also, I get to use my local text editors with mouse to edit the config files and save them directly to the Rpi.
Getting rid of the cursor
The touchscreen is set up, the orientation is correct (I didn't have to modify this?), time to get rid of the mouse cursor. I have edited the file /etc/lightdm/lightdm.conf
and added, NB! after [Seat:*]
the line xserver-command = X -nocursor
. This removes the cursor for good.
Starting up the fullscreen browser
Autostart
I have added some necessary commands to the ~/.config/lxsession/LXDE-pi/autostart
file. "~" means the user, in a standard installation it is pi. Also, files and folders beginning with a "." are hidden by default, in Cyberduck I have to select View hidden files from View dropdown menu to see them.
So my autostart file looks like this:
@xset s off # disable screen saver
@xset -dpms # disable DPMS (Energy Star) features.
@xset s noblank # don't blank the video device
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium-browser Default/Preferences
@/home/pi/.config/lxsession/LXDE-pi/start-chromium.sh
The sed line is there so Chromium thinks it shut down cleaning, even if it didn't, to prevent tab restore warnings.
The last line launches another script, I think this is better to add the pause necessary.
start-chromium.sh
I have created another script file in the same folder as the autostart file: ~/.config/lxsession/LXDE-pi/start-chromium.sh
. This filke needs to be given execute privileges. Again, in Cyberduck it is quite straightforward, but it could be done also by typing chmod 755 ~/.config/lxsession/LXDE-pi/start-chromium.sh
in terminal, once the file is created.
In this file I have the following lines:
#!/bin/sh
sleep 5
chromium-browser --display=:0 --kiosk --window-position=0,0 --disable-pinch --overscroll-history-navigation=0 --disable-translate --noerrdialogs http://127.0.0.1:1880/ui
most important stuff is after chromium-browser, we declare that is kiosk, so now frame or titlebar, there is the no-pinch, so no accidental zooming in or out, disabeling going back and forth between history states, to translation popups, no errors whatsoever.
I have given node-red 5 seconds to start up before launching Chrome, so there shouldn't be the flash of "this website is not reachable".
No selecting text
I have added the following CSS rule to a dashboard template node:
body {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
html {
touch-action: none;
}
Thanks to everybody who has written all this down before me.