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
+51 -2
View File
@@ -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 <<EOF
Start it by hand with: