Skip to content

Instantly share code, notes, and snippets.

@saper-2
Created January 4, 2024 12:22
Show Gist options
  • Save saper-2/4cba693126ca77c7eb5c8e67e57a5111 to your computer and use it in GitHub Desktop.
Save saper-2/4cba693126ca77c7eb5c8e67e57a5111 to your computer and use it in GitHub Desktop.
Setup simple KIOSK on Raspbian 12 (Bookworm) with Wayland/Wayfire

Prereqs

  1. Burn raspios image on card - the one with desktop (no need to additional software) - tested using 2023-12-05-raspios-bookworm-arm64.img on RPi4 & RPi5.
  2. Install few additional packages to build a wayland plugin that hide cursor
    sudo apt install libglibmm-2.4-dev libglm-dev libxml2-dev libpango1.0-dev libcairo2-dev wayfire-dev libwlroots-dev libwf-config-dev meson
  3. Clone github repo: https://github.com/saper-2/wayfire-plugins-extra , and compile plugins (but not install them)
    git clone https://github.com/WayfireWM/wayfire-plugins-extra && cd wayfire-plugins-extra
    meson build --prefix=/usr --buildtype=release
    ninja -C build
    
  4. Copy compiled plugin and it's config to designated dirs so wayfire can find it.
    ~/wayfire-plugins-extra $ sudo cp build/src/libhide-cursor.so /usr/lib/aarch64-linux-gnu/wayfire/
    ~/wayfire-plugins-extra $ sudo cp metadata/hide-cursor.xml /usr/share/wayfire/metadata/

Kiosk script

Create kiosk.sh script that will launch chromium-browser - it's content is in next file. Set your <kiosk-url> . I'm using pi user.

nano /home/pi/kiosk.sh
chmod +x /home/pi/kiosk.sh

Config Wayland/wayfire

  1. Edit wayland/wayfire user configuration file so when desktop load it will lauch kiosk.sh script and start chromium in full-screen mode.

    nano ~/.config/wayfire.ini
    

    Find section [autostart] , if not exists then create at end file this section and add option - option name can be anything (without spaces & special characters) - I just used kiosk . as option value enter full path to the kiosk.sh script.

    [autostart]
    kiosk = /home/pi/kiosk.sh
    
  2. Now look for section [core] if it's not exists create it, and tell wayland what plugins you want for it to load:

    [core]
    plugins = autostart hide-cursor
    

    This'll also disable all bars, desktop background, app menu (a.k.a. from M$win 'Start menu') & quick launch toolbar, clock, tray, etc..., you'll have only chromium-window launched. So there is no need to to fiddle with LXDE-pi config files and disable menus, desktop bg, etc... 👍

  3. Save file and reboot, should work.

#!/bin/bash
#Disable DPMS. In Bookworm (deb12) & Wayland DPMS is disabled by default (for now)
#xset -dpms
#xset s off
#xset s noblank
#unclutter only for X11, don't work in wayland anymore
#unclutter &
#Lets remove a lock file that could be caused due to a crash.
rm /home/pi/.config/chromium/SingletonLock
while true; do
# Clean up previously running apps, gracefully at first then harshly
killall -TERM chromium-browser 2>/dev/null;
sleep 2;
# still runnning? slay it!
killall -9 chromium-browser 2>/dev/null;
# Launch window manager without title bar.
# Run unclutter
# unclutter &
# Launch browser.
# If you want use AppMode then don't forget for maximized and fullscreen otherwise window with browser won't show up itself.
# Replace <kiosk-url> with your URL
# You might want to remove incognito argument if you need to log-in into page and keep it logged up.
chromium-browser --incognito --start-fullscreen --start-maximized --kiosk --noerrdialogs --disable-default-apps --disable-single-click-autofill --disable-translate-new-ux --disable-translate --disable-cache --disk-cache-dir=/dev/null --disk-cache-size=1 --reduce-security-for-testing --app=http://<kiosk-url>/
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment