# What I did to run Rpi touchscreen in Kiosk mode

**URL:** https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413
**Category:** Share Your Projects
**Created:** [10 March 2021 13:27 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413 "2021-03-10T13:27:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![PaulKana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulkana/32/37106_2.png) [@PaulKana](https://discourse.nodered.org/u/PaulKana)
#### Post date: [10 March 2021 13:27 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413/1 "2021-03-10T13:27:04Z")

</div>

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](https://nodered.org/docs/getting-started/raspberrypi).

**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:

```auto
@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:

```auto
#!/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:

```auto
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.

---

<div class="post-metadata">

### Author: ![Simon01011](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@Simon01011](https://discourse.nodered.org/u/Simon01011)
#### Post date: [10 March 2021 13:37 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413/2 "2021-03-10T13:37:56Z")

</div>

Nice project!

If you do not disable the screen saver and energy saving, will the display go out after a while? So that the display is actually dark (e.g. at night, when no one uses it). And will it "wake up" if you touch the screen?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [10 March 2021 13:58 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413/3 "2021-03-10T13:58:37Z")

</div>

Nice work, thanks for sharing.

In regard to remote editing - you might want to look at VSCode with the official remote extension that lets you edit files over an SSH connection - it also gives you a tree view of your files and folders of course and even gives you a remote command line. All integrated into the VSCode IDE - and all for free!

You can save the config as a "workspace" or project so that you can go straight into a remote session. I find this massively helpful to working on more complex uibuilder front-end apps and messing around with my production home automation server.

---

<div class="post-metadata">

### Author: ![PaulKana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulkana/32/37106_2.png) [@PaulKana](https://discourse.nodered.org/u/PaulKana)
#### Post date: [10 March 2021 15:28 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413/4 "2021-03-10T15:28:41Z")

</div>

I guess that would be the case, in our use the operator turns all the machinery off after finishing the task.

This is something I didn't mention - I have a button on the dashboard that sends `sudo halt` to the exec node so we can turn off the Rpi from the touch interface. And I have added a switch to the case that shorts the 5&6 GPIO pin to turn the Rpi on.

---

<div class="post-metadata">

### Author: ![PaulKana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulkana/32/37106_2.png) [@PaulKana](https://discourse.nodered.org/u/PaulKana)
#### Post date: [10 March 2021 15:29 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413/5 "2021-03-10T15:29:57Z")

</div>

Ok, nice, I'll look into it.

---

<div class="post-metadata">

### Author: ![SonoraTechnical](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sonoratechnical/32/20033_2.png) [@SonoraTechnical](https://discourse.nodered.org/u/SonoraTechnical)
#### Post date: [10 March 2021 19:03 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413/6 "2021-03-10T19:03:00Z")

</div>

I did the same with mine, with the exception of the screen blanking... I do allow the screen saver (blank screen), simply because I don't want the 'glow' at night.

I did add the Sleep to my start-chromium.sh file as well... as occasionally on restarts I would see that message and have to 'reload' the page. I just hadn't gotten around to figuring out a solution.... waiting 5 seconds is good!

Thank you for posting that helpful information.

---

<div class="post-metadata">

### Author: ![SonoraTechnical](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sonoratechnical/32/20033_2.png) [@SonoraTechnical](https://discourse.nodered.org/u/SonoraTechnical)
#### Post date: [10 March 2021 19:04 UTC](https://discourse.nodered.org/t/what-i-did-to-run-rpi-touchscreen-in-kiosk-mode/42413/7 "2021-03-10T19:04:23Z")

</div>

Yes.. see my note below.. that is what I did so that it goes dark...
