From c5b8d04b840edf41bd6f401dc2355054f7ae3457 Mon Sep 17 00:00:00 2001 From: jasonwitty Date: Mon, 10 Aug 2026 00:47:36 -0700 Subject: [PATCH] Add --noblank, and fix install.sh exiting early when no relogin is needed Wall displays must never blank. --noblank applies two layers: an Xorg ServerFlags snippet with all four timeouts at 0 (covers the DM greeter, and survives reboots) and an xset line in the i3 autostart (a session or DM can re-enable the screensaver after X starts). Either alone is insufficient. Documents the trap that cost time here: `sudo xset ...` targets root's X connection and silently does nothing, so a `sudo bash noblank.sh` wrapper looks like it worked while blanking stays fully armed. Also fixes a latent bug: `[ "$relogin" = yes ] && echo ...` as the final statement made install.sh exit non-zero under `set -e` -- and skip the closing instructions -- whenever a relogin was not required. Co-Authored-By: Claude Opus 5 --- README.md | 34 +++++++++++++++++++++++++++++++++ install.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++-- uninstall.sh | 6 ++++++ 3 files changed, 91 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 090be96..ead79df 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ fresh session. | *(none)* | Build/install lisgd, install the three scripts and the default config | | `--xignore` | Also tell X to ignore the touch panel (see below — usually wanted) | | `--i3` | Also add i3 autostart lines, with a backup and `i3 -C` validation | +| `--noblank` | Also stop the screen blanking / DPMS power-down (wall displays) | Re-running is safe: an existing config file is never overwritten, and the i3 edit is skipped if already present. @@ -121,6 +122,39 @@ device exclusively, so two instances make every swipe fire twice. `socktop-gestures` enforces this: it exits non-zero if one is already running, unless given `--replace`. +## Stopping the screen blanking + +A wall display must never blank. `./install.sh --noblank` applies two layers: + +1. An Xorg `ServerFlags` snippet with all four timeouts at `0`, so it covers + every X session including the display-manager greeter, and survives reboots. +2. An `xset s off s noblank -dpms` line in the i3 autostart, because a session + or DM can re-enable the screensaver after X has started. + +Both are needed. `xset` alone does not survive a reboot, and — the trap worth +knowing — **`xset` must run as the session user**. Running `sudo xset ...`, or a +`sudo bash noblank.sh` wrapper, targets root's X connection and silently does +nothing while appearing to succeed. Check the real state with: + +```sh +xset q | grep -A1 -E 'Screen Saver|DPMS' +``` + +You want `timeout: 0`, `prefer blanking: no`, and `DPMS is Disabled`. + +### Related: does the display come back by itself? + +Blanking is only half of unattended operation. If the display manager has no +autologin configured, a reboot leaves the panel at a login prompt and nothing +autostarts. Check with: + +```sh +grep -E '^autologin-(user|session)' /etc/lightdm/lightdm.conf +``` + +No output means no autologin. Configuring it is out of scope here — it weakens +the machine's security posture and is a deliberate choice, not a default. + ## Uninstall ```sh diff --git a/install.sh b/install.sh index ccf1220..82fe635 100755 --- a/install.sh +++ b/install.sh @@ -4,7 +4,8 @@ # ./install.sh scripts + config + lisgd (build if missing) # ./install.sh --xignore ...and tell X to ignore the touch panel # ./install.sh --i3 ...and add i3 autostart lines -# ./install.sh --xignore --i3 full display-host setup +# ./install.sh --noblank ...and stop the screen blanking +# ./install.sh --xignore --i3 --noblank full wall-display setup # # Safe to re-run: an existing config file is never overwritten, and the i3 edit # is skipped if already present. @@ -15,15 +16,18 @@ BIN="$PREFIX/bin" ETC="$PREFIX/etc" CONF="$ETC/socktop-swipe.env" XCONF=/etc/X11/xorg.conf.d/99-ignore-touch-socktop-swipe.conf +BCONF=/etc/X11/xorg.conf.d/10-no-blanking-socktop-swipe.conf SRC="$HOME/src/lisgd" here=$(cd "$(dirname "$0")" && pwd) do_xignore=no do_i3=no +do_noblank=no for a in "$@"; do case "$a" in --xignore) do_xignore=yes ;; --i3) do_i3=yes ;; + --noblank) do_noblank=yes ;; *) echo "unknown option: $a" >&2; exit 2 ;; esac done @@ -100,6 +104,49 @@ EOF relogin=yes fi +# --- optional: stop the screen blanking ------------------------------------- +if [ "$do_noblank" = yes ]; then + echo "==> disabling screen blanking and DPMS" + # Two layers on purpose: + # 1. An Xorg ServerFlags snippet, so it applies to every X session including + # the display manager greeter, and survives reboots. + # 2. An xset call at i3 startup, because a session or DM can re-enable the + # screensaver after X starts. + # Note `xset` alone is NOT enough, and must run as the session user -- running + # it under sudo targets root's X connection and silently does nothing. + sudo mkdir -p /etc/X11/xorg.conf.d + sudo tee "$BCONF" >/dev/null <<'EOF' +# Installed by socktop-swipe. This is a wall display: it must never blank. +Section "ServerFlags" + Option "BlankTime" "0" + Option "StandbyTime" "0" + Option "SuspendTime" "0" + Option "OffTime" "0" +EndSection +EOF + echo " wrote $BCONF" + + # Apply immediately too, if a session is available. + if [ -n "${DISPLAY:-}" ]; then + xset s off s noblank -dpms 2>/dev/null || true + echo " applied to the running session" + fi + + i3conf="$HOME/.config/i3/config" + if [ -e "$i3conf" ] && ! grep -q "xset s off" "$i3conf"; then + bak="$i3conf.bak-$(date +%Y%m%d-%H%M%S)" + cp "$i3conf" "$bak" + printf '\n# Wall display: never blank (socktop-swipe --noblank)\nexec --no-startup-id xset s off s noblank -dpms\n' >>"$i3conf" + if i3 -C -c "$i3conf" >/dev/null 2>&1; then + echo " added xset to i3 autostart (backup: $bak)" + else + cp "$bak" "$i3conf" + echo "!! i3 rejected the config; restored $bak" >&2 + fi + fi + relogin=yes +fi + # --- optional: i3 autostart ------------------------------------------------- if [ "$do_i3" = yes ]; then i3conf="$HOME/.config/i3/config" @@ -133,7 +180,9 @@ fi echo echo "==============================================================" echo "Installed." -[ "$relogin" = yes ] && echo "LOG OUT and back in before use (group and/or X changes)." +if [ "$relogin" = yes ]; then + echo "LOG OUT and back in before use (group and/or X changes)." +fi cat <