2026-11-07 17:03:12 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
# Blank/restore the display without engaging the passcode locker (U1).
|
|
|
|
|
# sxmo_wm.sh display off/on already handles brightness, bl_power, DPMS,
|
|
|
|
|
# the CPU governor and the keyboard backlight.
|
2026-11-07 17:56:55 +02:00
|
|
|
#
|
|
|
|
|
# A wake-grace guard makes this safe even on the legacy sxmo_idle.sh path:
|
|
|
|
|
# xprintidle can report a stale large idle value right after a wake, which
|
|
|
|
|
# used to fire the blank command again immediately.
|
|
|
|
|
WAKE_TS=/tmp/bananarchy_last_wake
|
|
|
|
|
GRACE="${BANANARCHY_IDLE_BLANK_GRACE:-10}"
|
|
|
|
|
|
2026-11-07 17:03:12 +02:00
|
|
|
case "${1:-}" in
|
2026-11-07 17:56:55 +02:00
|
|
|
off)
|
|
|
|
|
now=$(date +%s)
|
|
|
|
|
last=0
|
|
|
|
|
[ -r "$WAKE_TS" ] && { read -r last < "$WAKE_TS" 2>/dev/null || last=0; }
|
|
|
|
|
case "$last" in ''|*[!0-9]*) last=0 ;; esac
|
|
|
|
|
if [ $((now - last)) -lt "$GRACE" ]; then
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
exec /usr/bin/sxmo_wm.sh display off
|
|
|
|
|
;;
|
|
|
|
|
on)
|
|
|
|
|
date +%s > "$WAKE_TS" 2>/dev/null || true
|
|
|
|
|
exec /usr/bin/sxmo_wm.sh display on
|
|
|
|
|
;;
|
2026-11-07 17:03:12 +02:00
|
|
|
*)
|
|
|
|
|
printf 'Usage: %s [off|on]\n' "${0##*/}" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|