From 1ab3c63f16c497fa468d1e5d558bc9d5310d2520 Mon Sep 17 00:00:00 2001 From: nearxos Date: Thu, 8 Jan 2026 10:36:17 +0200 Subject: [PATCH] Initial commit: Chromium auto-start configuration for reTerminal DM4 --- chromium-setup/README.md | 147 ++++++++++++++++++++++++++ chromium-setup/chromium-kiosk.desktop | 7 ++ chromium-setup/start-chromium.sh | 46 ++++++++ 3 files changed, 200 insertions(+) create mode 100644 chromium-setup/README.md create mode 100644 chromium-setup/chromium-kiosk.desktop create mode 100755 chromium-setup/start-chromium.sh diff --git a/chromium-setup/README.md b/chromium-setup/README.md new file mode 100644 index 0000000..9de102b --- /dev/null +++ b/chromium-setup/README.md @@ -0,0 +1,147 @@ +# Chromium Auto-Start Configuration for Raspberry Pi + +This directory contains scripts and configuration files to automatically start Chromium in fullscreen mode on boot for a Raspberry Pi device (reTerminal DM4). + +## Files + +- **`start-chromium.sh`** - Main startup script that launches Chromium with proper configuration +- **`chromium-kiosk.desktop`** - Autostart desktop entry file +- **`README.md`** - This documentation file + +## Overview + +This setup configures Chromium to: +- Start automatically on boot +- Open in fullscreen mode at `http://127.0.0.1:8080` +- Avoid keyring password prompts +- Prevent restore session notifications +- Properly fill the entire screen (fixes Wayland/X11 fullscreen issues) +- Support both fullscreen and kiosk modes (switchable via script) + +## Installation + +### Prerequisites + +1. **SSH access** to the Raspberry Pi device +2. **Auto-login enabled** (required for autostart to work) +3. **Chromium installed**: `sudo apt-get install chromium` +4. **wmctrl installed**: `sudo apt-get install wmctrl` (for fullscreen forcing) + +### Setup Steps + +1. **Copy the startup script to the device:** + ```bash + scp start-chromium.sh pi@:/home/pi/start-chromium.sh + ssh pi@ "chmod +x /home/pi/start-chromium.sh" + ``` + +2. **Create autostart directory and copy desktop file:** + ```bash + ssh pi@ "mkdir -p ~/.config/autostart" + scp chromium-kiosk.desktop pi@:/home/pi/.config/autostart/chromium-kiosk.desktop + ``` + +3. **Install wmctrl (if not already installed):** + ```bash + ssh pi@ "sudo apt-get update && sudo apt-get install -y wmctrl" + ``` + +4. **Reboot to test:** + ```bash + ssh pi@ "sudo reboot" + ``` + +## Configuration + +### Switching Between Fullscreen and Kiosk Mode + +Edit `/home/pi/start-chromium.sh` on the device: + +- **Fullscreen mode** (current): Uncomment the fullscreen line, comment out the kiosk line +- **Kiosk mode**: Comment out the fullscreen line, uncomment the kiosk line + +### Changing the URL + +Edit the `--app=http://127.0.0.1:8080` parameter in `start-chromium.sh` to point to your desired URL. + +### Adjusting Delays + +If Chromium doesn't start properly on boot, you may need to increase delays: +- Line 25: `sleep 5` - Delay before starting Chromium +- Line 32: `sleep 3` - Delay before forcing fullscreen + +## Troubleshooting + +### Chromium doesn't start on boot +- Verify auto-login is enabled: `sudo raspi-config` → Boot Options → Desktop Autologin +- Check if the script is executable: `chmod +x ~/start-chromium.sh` +- Check autostart file exists: `ls -la ~/.config/autostart/chromium-kiosk.desktop` + +### Fullscreen doesn't work properly +- Ensure `wmctrl` is installed: `sudo apt-get install wmctrl` +- Check if X11 is being used (not Wayland): The script forces X11 with `--ozone-platform=x11` +- Manually test: `DISPLAY=:0 ~/start-chromium.sh` + +### Keyring password prompt appears +- The script includes `--password-store=basic --use-mock-keychain` flags +- If it still appears, you may need to set an empty password for the keyring once + +### Restore session notification appears +- The script includes `--disable-session-crashed-bubble --disable-restore-session-state` flags +- If it still appears, clear Chromium's session data: `rm -rf ~/.config/chromium/Session*` + +## Manual Testing + +Test the script without rebooting: +```bash +ssh pi@ "pkill chromium && sleep 2 && DISPLAY=:0 ~/start-chromium.sh" +``` + +## Exiting Fullscreen/Kiosk Mode + +- **Fullscreen mode**: Press `F11` to toggle fullscreen, or `Alt+F4` to close +- **Kiosk mode**: Use `Ctrl+Alt+T` to open terminal, then `pkill chromium` +- **From SSH**: `ssh pi@ "pkill chromium"` + +## Disabling Autostart + +To temporarily disable autostart: +```bash +ssh pi@ "mv ~/.config/autostart/chromium-kiosk.desktop ~/.config/autostart/chromium-kiosk.desktop.disabled" +``` + +To re-enable: +```bash +ssh pi@ "mv ~/.config/autostart/chromium-kiosk.desktop.disabled ~/.config/autostart/chromium-kiosk.desktop" +``` + +## Chromium Flags Explained + +- `--start-fullscreen` - Start in fullscreen mode +- `--kiosk` - Kiosk mode (no UI, harder to exit) +- `--noerrdialogs` - Suppress error dialogs +- `--disable-infobars` - Remove info bars +- `--disable-session-crashed-bubble` - Disable crash notifications +- `--disable-restore-session-state` - Don't restore previous session +- `--no-first-run` - Skip first-run dialogs +- `--password-store=basic` - Use unencrypted password store (no keyring) +- `--use-mock-keychain` - Avoid keychain prompts +- `--ozone-platform=x11` - Force X11 instead of Wayland (better fullscreen) +- `--app=` - Run as app (no address bar, cleaner interface) + +## Device Information + +- **Device**: reTerminal DM4 (Raspberry Pi) +- **OS**: Raspberry Pi OS (Debian-based) +- **Tested on**: Linux raspberrypi 6.12.62+rpt-rpi-v8 + +## Notes + +- The script waits for the desktop environment to be ready before starting Chromium +- It uses `wmctrl` to programmatically force fullscreen after Chromium starts +- X11 is forced instead of Wayland for better fullscreen compatibility +- The script runs in the background and maintains the Chromium process + +## License + +This configuration is provided as-is for use with the reTerminal DM4 project. diff --git a/chromium-setup/chromium-kiosk.desktop b/chromium-setup/chromium-kiosk.desktop new file mode 100644 index 0000000..0a18c43 --- /dev/null +++ b/chromium-setup/chromium-kiosk.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=Chromium Fullscreen +Exec=/home/pi/start-chromium.sh +Hidden=false +NoDisplay=false +X-GNOME-Autostart-enabled=true diff --git a/chromium-setup/start-chromium.sh b/chromium-setup/start-chromium.sh new file mode 100755 index 0000000..04cf078 --- /dev/null +++ b/chromium-setup/start-chromium.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Disable keyring prompts +export GNOME_KEYRING_CONTROL="" +export DISPLAY=:0 + +# Force X11 instead of Wayland for better fullscreen support +export GDK_BACKEND=x11 +unset WAYLAND_DISPLAY + +# Wait for display and desktop environment to be ready +# Check if DISPLAY is accessible (wait up to 30 seconds) +for i in {1..60}; do + if xset q >/dev/null 2>&1 || [ -n "$DISPLAY" ]; then + # Wait for desktop environment to be fully loaded + if pgrep -x pcmanfm >/dev/null 2>&1 || pgrep -x lxsession >/dev/null 2>&1 || pgrep -x xfdesktop >/dev/null 2>&1; then + break + fi + fi + sleep 0.5 +done + +# Additional delay to ensure window manager is fully ready +sleep 5 + +# Start Chromium with flags to avoid keyring and ensure proper fullscreen +# Force X11 platform and add fullscreen-related flags +# Fullscreen mode (current active) +/usr/bin/chromium --start-fullscreen --noerrdialogs --disable-infobars --disable-session-crashed-bubble --disable-restore-session-state --no-first-run --password-store=basic --use-mock-keychain --ozone-platform=x11 --disable-features=UseChromeOSDirectVideoDecoder --app=http://127.0.0.1:8080 & + +# Wait for Chromium window to appear and then force fullscreen +sleep 3 +# Try to find Chromium window and force it to fullscreen +for i in {1..10}; do + WINDOW_ID=$(wmctrl -l 2>/dev/null | grep -i chromium | head -1 | awk '{print $1}') + if [ -n "$WINDOW_ID" ]; then + wmctrl -i -r "$WINDOW_ID" -b add,fullscreen 2>/dev/null + break + fi + sleep 0.5 +done + +# Keep script running +wait + +# Kiosk mode (commented out - uncomment to use instead of fullscreen) +# /usr/bin/chromium --kiosk --noerrdialogs --disable-infobars --disable-session-crashed-bubble --disable-restore-session-state --no-first-run --password-store=basic --use-mock-keychain --ozone-platform=x11 --app=http://127.0.0.1:8080