Files
reterminal-dm4/emmc-provisioning/cloud-init/fileserver/start-chromium.sh
nearxos c91cf6dd05 Update first-boot configuration and scripts for enhanced kiosk functionality</message>
<message>Modify the first-boot configuration to include the gir1.2-gtklayershell-0.1 package for improved GTK layer shell support. Update the first-boot script to enhance the portal status reporting with connection timeouts. Additionally, implement a restart mechanism for the kanshi service in rotation scripts to ensure immediate application of configuration changes. Introduce a Chromium kiosk extension to disable text selection, improving user experience in kiosk mode. These changes streamline the setup process and enhance the overall functionality of the kiosk environment.
2026-02-23 18:07:14 +02:00

48 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Revision: 2
# Start Chromium in app mode. Optional env vars:
# CHROMIUM_APP_URL - URL to open (default: http://127.0.0.1:8080)
# CHROMIUM_MODE - "kiosk" (default, fills whole screen) or "fullscreen"
#
# Touch long-press → right-click: In Chromium on Wayland, long-press often does *not*
# open the context menu (Chromium handles touch itself). Elsewhere (e.g. desktop) it may
# work. For long-press right-click *inside* Chromium, use evdev-right-click-emulation
# at the input layer so all apps (including Chromium) receive real right-click events:
# https://github.com/PeterCxy/evdev-right-click-emulation
#
# Disable keyring prompts
export GNOME_KEYRING_CONTROL=""
# Wayland + labwc compositor.
export GDK_BACKEND=wayland
# Wait for compositor
for i in {1..60}; do
if [ -S "${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/$WAYLAND_DISPLAY" ]; then
pgrep -x labwc >/dev/null 2>&1 && break
fi
sleep 0.5
done
# URL to open in Chromium (app mode)
#CHROMIUM_APP_URL="${CHROMIUM_APP_URL:-http://127.0.0.1:8080}"
CHROMIUM_APP_URL="${CHROMIUM_APP_URL:-https://tototheo.com}"
# Mode: "kiosk" (fills whole screen, no taskbar gap) or "fullscreen"
CHROMIUM_MODE="${CHROMIUM_MODE:-kiosk}"
# Extension disables text selection so touch-drag scrolls (see chromium-kiosk-no-select)
EXTENSION_DIR="${HOME}/.local/share/chromium-kiosk-no-select"
CHROMIUM_OPTS="--noerrdialogs --disable-infobars --disable-session-crashed-bubble --disable-restore-session-state --no-first-run --password-store=basic --use-mock-keychain --ozone-platform=wayland --enable-features=WaylandWindowDecorations,TouchpadOverscrollHistoryNavigation --disable-features=UseChromeOSDirectVideoDecoder --touch-events=enabled --enable-pinch --disable-translate"
[ -d "$EXTENSION_DIR" ] && CHROMIUM_OPTS="$CHROMIUM_OPTS --load-extension=$EXTENSION_DIR"
CHROMIUM_OPTS="$CHROMIUM_OPTS --app=${CHROMIUM_APP_URL}"
case "${CHROMIUM_MODE}" in
kiosk) CHROMIUM_OPTS="--kiosk ${CHROMIUM_OPTS}" ;;
*) CHROMIUM_OPTS="--start-fullscreen ${CHROMIUM_OPTS}" ;;
esac
sleep 3
/usr/bin/chromium $CHROMIUM_OPTS &
# Keep script running
wait