diff --git a/README.md b/README.md index b2762dc..9f752b9 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ The installer: 3. Copies the dashboard to `~/kids-dashboard/`. Writes `config.js` (location) and `screen.conf` (night schedule). 4. Adds the kiosk to `~/.config/labwc/autostart`. If Chromium crashes, `lwrespawn` restarts it. 5. Sets up the night-off cron jobs and the `tap-wake` systemd user service. -6. Makes the desktop plain black with no icons and auto-hides the taskbar, since it shows for ~30s at boot - before Chromium starts. `--uninstall` puts the original desktop settings back. +6. Makes the desktop plain black with no icons, since it shows for ~30s at boot before Chromium starts, + and the kiosk stops the taskbar. `--uninstall` puts the original desktop back (after a reboot). It's safe to re-run, and settings you don't pass are kept from the last run. diff --git a/bin/kiosk.sh b/bin/kiosk.sh index 3b095ab..94b178f 100755 --- a/bin/kiosk.sh +++ b/bin/kiosk.sh @@ -9,6 +9,11 @@ PREF="$PROFILE/Default/Preferences" # from a reboot at whatever level it was saved at (maybe the dim night level), and # tap-to-wake only acts on a screen that's off ( sleep 5; "$DIR/screen.sh" auto ) & +# no taskbar on a kiosk: it shows through at boot until Chromium covers the screen, and it +# won't auto-hide while it has notifications up. Stop it (and its respawner) as it appears. +( for _ in $(seq 20); do + pkill -f 'lwrespawn /usr/bin/wf-panel-pi' 2>/dev/null; pkill -x wf-panel-pi 2>/dev/null; sleep 2 + done ) & exec chromium --kiosk --user-data-dir="$PROFILE" \ --ozone-platform=wayland --noerrdialogs --disable-infobars --no-first-run \ --hide-crash-restore-bubble --password-store=basic --disable-pinch \ diff --git a/install.sh b/install.sh index 6db4c48..e2608ab 100755 --- a/install.sh +++ b/install.sh @@ -59,16 +59,15 @@ remove_cron() { (crontab -l 2>/dev/null || true) | { grep -vE 'kids-dashboard/(s restart_kiosk() { pkill -f -- "--user-data-dir=$PROFILE" 2>/dev/null || true; } # lwrespawn relaunches it # The desktop shows for ~30s at boot before Chromium covers it: make it plain black with no -# icons, and auto-hide the taskbar. Originals are kept as *.kids-dashboard-orig for --uninstall. +# icons (kiosk.sh stops the taskbar). Originals are kept as *.kids-dashboard-orig for --uninstall. PCMANFM_DIR="$HOME/.config/pcmanfm/default" -PANEL_INI="$HOME/.config/wf-panel-pi/wf-panel-pi.ini" ORIG=.kids-dashboard-orig set_key() { # set_key FILE KEY VALUE (single-section ini files) if grep -q "^$2=" "$1"; then sed -i "s|^$2=.*|$2=$3|" "$1"; else echo "$2=$3" >> "$1"; fi } -restart_desktop() { pkill -x pcmanfm 2>/dev/null || true; pkill -x wf-panel-pi 2>/dev/null || true; } # lwrespawn relaunches them +restart_desktop() { pkill -x pcmanfm 2>/dev/null || true; } # lwrespawn relaunches it black_desktop() { - mkdir -p "$PCMANFM_DIR" "$(dirname "$PANEL_INI")" + mkdir -p "$PCMANFM_DIR" local out f # pcmanfm keeps one file per screen (desktop-items-.conf); make sure every screen has one for out in $(XDG_RUNTIME_DIR=/run/user/$(id -u) WAYLAND_DISPLAY=wayland-0 wlr-randr 2>/dev/null | awk '/^[^ ]/{print $1}'); do @@ -82,13 +81,12 @@ black_desktop() { for k in desktop_bg desktop_fg desktop_shadow; do set_key "$f" "$k" '#000000'; done for k in show_trash show_mounts show_documents; do set_key "$f" "$k" 0; done done - [ -f "$PANEL_INI" ] || cp /etc/xdg/wf-panel-pi/wf-panel-pi.ini "$PANEL_INI" 2>/dev/null || echo '[panel]' > "$PANEL_INI" - [ -f "$PANEL_INI$ORIG" ] || cp "$PANEL_INI" "$PANEL_INI$ORIG" - set_key "$PANEL_INI" autohide true } restore_desktop() { local f - for f in "$PCMANFM_DIR"/*"$ORIG" "$PANEL_INI$ORIG"; do [ -f "$f" ] && mv "$f" "${f%"$ORIG"}"; done + for f in "$PCMANFM_DIR"/*"$ORIG" "$HOME/.config/wf-panel-pi/wf-panel-pi.ini$ORIG"; do # (older installs edited the panel too) + [ -f "$f" ] && mv "$f" "${f%"$ORIG"}" + done restart_desktop } @@ -229,8 +227,10 @@ EOF fi # ---- black desktop behind the kiosk --------------------------------------------------------- -say "Desktop: plain black, taskbar auto-hidden (shows only while booting)" +say "Desktop: plain black with no icons or taskbar (it only shows while booting)" black_desktop +f="$HOME/.config/wf-panel-pi/wf-panel-pi.ini" # undo the auto-hide an earlier version set +[ -f "$f$ORIG" ] && mv "$f$ORIG" "$f" pgrep -u "$USER" -x labwc >/dev/null && restart_desktop # ---- night-off schedule + tap to wake -----------------------------------------------------