Skip to content

Instantly share code, notes, and snippets.

@HonbraDev
Last active September 17, 2024 13:39
Show Gist options
  • Save HonbraDev/d6a6c80d97631743f07901ec8918f49c to your computer and use it in GitHub Desktop.
Save HonbraDev/d6a6c80d97631743f07901ec8918f49c to your computer and use it in GitHub Desktop.
Ubuntu Server 20.04 LTS Firefox kiosk
# Stop the kiosk service
sudo systemctl stop kiosk
# Remove the kiosk service from startup
sudo systemctl disable kiosk
# Remove the kiosk service
sudo rm -f /etc/systemd/system/kiosk.service
# Reload systemctl daemons
sudo systemctl daemon-reload
# Remove the kiosk startup file and directory
sudo rm -rf /opt/kiosk
# Remove X.org, OpenBox, Firefox and autoremove associated programs no longer in use
sudo apt remove --autoremove -y xorg openbox firefox
# Install X.org, OpenBox, Firefox
sudo apt install --no-install-recommends -y xorg openbox firefox
# Write X.org startup script to /opt/kiosk/kiosk.sh
sudo mkdir /opt/kiosk
echo "xset s
xset -dpms
off openbox-session &
while true;
do
/usr/bin/firefox --kiosk --private-window 'https://honbra.com/'
done" | sudo tee /opt/kiosk/kiosk.sh
# Write service file to /etc/systemd/system/kiosk.service
echo "[Unit]
Description=Start kiosk
[Service]
Type=simple
ExecStart=sudo startx /etc/X11/Xsession /opt/kiosk/kiosk.sh
[Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/kiosk.service
# Add permissions to the files
sudo chmod 644 /etc/systemd/system/kiosk.service
sudo chmod +x /opt/kiosk/kiosk.sh
# Enable the service on startup
sudo systemctl daemon-reload
sudo systemctl enable kiosk
# Finish
echo "Edit /etc/systemd/system/kiosk.service to change the website.
Run 'sudo systemctl start kiosk' to start the kiosk
Thanks for using the Kiosk gist by @HonbraDev :)"
@macvenez
Copy link

Hi, thanks for the scripts, they work fine!
Only issue I'm facing is the display is not fullscreen, how can I set its resolution? Thanks

@bakerof
Copy link

bakerof commented Dec 20, 2023

Only issue I'm facing is the display is not fullscreen, how can I set its resolution? Thanks

You should edit /opt/kiosk/kiosk.sh and add resolution parameters before --private-window. For example if you have 1920x1080 you should have string like this:

/usr/bin/firefox --kiosk --height 1080 --width 1920 --private-window 'https://honbra.com/'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment