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 <noreply@anthropic.com>
This commit is contained in:
jasonwitty
2026-08-10 00:47:36 -07:00
parent 9a47fd47a7
commit c5b8d04b84
3 changed files with 91 additions and 2 deletions
+34
View File
@@ -62,6 +62,7 @@ fresh session.
| *(none)* | Build/install lisgd, install the three scripts and the default config | | *(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) | | `--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 | | `--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 Re-running is safe: an existing config file is never overwritten, and the i3
edit is skipped if already present. 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, `socktop-gestures` enforces this: it exits non-zero if one is already running,
unless given `--replace`. 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 ## Uninstall
```sh ```sh
+51 -2
View File
@@ -4,7 +4,8 @@
# ./install.sh scripts + config + lisgd (build if missing) # ./install.sh scripts + config + lisgd (build if missing)
# ./install.sh --xignore ...and tell X to ignore the touch panel # ./install.sh --xignore ...and tell X to ignore the touch panel
# ./install.sh --i3 ...and add i3 autostart lines # ./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 # Safe to re-run: an existing config file is never overwritten, and the i3 edit
# is skipped if already present. # is skipped if already present.
@@ -15,15 +16,18 @@ BIN="$PREFIX/bin"
ETC="$PREFIX/etc" ETC="$PREFIX/etc"
CONF="$ETC/socktop-swipe.env" CONF="$ETC/socktop-swipe.env"
XCONF=/etc/X11/xorg.conf.d/99-ignore-touch-socktop-swipe.conf 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" SRC="$HOME/src/lisgd"
here=$(cd "$(dirname "$0")" && pwd) here=$(cd "$(dirname "$0")" && pwd)
do_xignore=no do_xignore=no
do_i3=no do_i3=no
do_noblank=no
for a in "$@"; do for a in "$@"; do
case "$a" in case "$a" in
--xignore) do_xignore=yes ;; --xignore) do_xignore=yes ;;
--i3) do_i3=yes ;; --i3) do_i3=yes ;;
--noblank) do_noblank=yes ;;
*) echo "unknown option: $a" >&2; exit 2 ;; *) echo "unknown option: $a" >&2; exit 2 ;;
esac esac
done done
@@ -100,6 +104,49 @@ EOF
relogin=yes relogin=yes
fi 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 ------------------------------------------------- # --- optional: i3 autostart -------------------------------------------------
if [ "$do_i3" = yes ]; then if [ "$do_i3" = yes ]; then
i3conf="$HOME/.config/i3/config" i3conf="$HOME/.config/i3/config"
@@ -133,7 +180,9 @@ fi
echo echo
echo "==============================================================" echo "=============================================================="
echo "Installed." 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 <<EOF cat <<EOF
Start it by hand with: Start it by hand with:
+6
View File
@@ -11,6 +11,7 @@ PREFIX=${PREFIX:-/usr/local}
BIN="$PREFIX/bin" BIN="$PREFIX/bin"
CONF="$PREFIX/etc/socktop-swipe.env" CONF="$PREFIX/etc/socktop-swipe.env"
XCONF=/etc/X11/xorg.conf.d/99-ignore-touch-socktop-swipe.conf XCONF=/etc/X11/xorg.conf.d/99-ignore-touch-socktop-swipe.conf
BCONF=/etc/X11/xorg.conf.d/10-no-blanking-socktop-swipe.conf
keep_config=no keep_config=no
[ "${1:-}" = "--keep-config" ] && keep_config=yes [ "${1:-}" = "--keep-config" ] && keep_config=yes
@@ -36,6 +37,11 @@ if [ -e "$XCONF" ]; then
echo "removed $XCONF (touch returns to X after the next X restart)" echo "removed $XCONF (touch returns to X after the next X restart)"
fi fi
if [ -e "$BCONF" ]; then
sudo rm -f "$BCONF"
echo "removed $BCONF (screen blanking returns after the next X restart)"
fi
echo echo
echo "Left in place on purpose:" echo "Left in place on purpose:"
echo " * lisgd -- remove with: sudo make -C ~/src/lisgd uninstall" echo " * lisgd -- remove with: sudo make -C ~/src/lisgd uninstall"