Trigger the screenlock daemon on idle screen blanking
This commit is contained in:
1 parent
77d95c715c
commit
5d859d7b11
11 files changed
+382
-12
No files matched your search
@@ -1,13 +1,17 @@
|
||||
#!/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.
|
||||
# Blank/restore the display and arm the screenlock daemon (U1).
|
||||
# sxmo_wm.sh display off/on handles brightness, bl_power, DPMS, the CPU
|
||||
# governor and the keyboard backlight. bananarchy-idle-lock.sh then arms the
|
||||
# trusted screenoff transition that starts xlocker screenoff (LOCK_BLANK on
|
||||
# locker.so); without it the resident locker daemon never sees a blank event.
|
||||
#
|
||||
# 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
|
||||
WAKE_TS="${BANANARCHY_WAKE_TS:-/tmp/bananarchy_last_wake}"
|
||||
GRACE="${BANANARCHY_IDLE_BLANK_GRACE:-10}"
|
||||
LOCK_HELPER="${BANANARCHY_IDLE_LOCK_HELPER:-/usr/bin/bananarchy-idle-lock.sh}"
|
||||
WM_CMD="${BANANARCHY_WM_CMD:-/usr/bin/sxmo_wm.sh}"
|
||||
|
||||
case "${1:-}" in
|
||||
off)
|
||||
@@ -18,14 +22,22 @@ case "${1:-}" in
|
||||
if [ $((now - last)) -lt "$GRACE" ]; then
|
||||
exit 0
|
||||
fi
|
||||
exec /usr/bin/sxmo_wm.sh display off
|
||||
"$WM_CMD" display off >/dev/null 2>&1 || true
|
||||
"$LOCK_HELPER" arm >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
;;
|
||||
on)
|
||||
"$LOCK_HELPER" cancel >/dev/null 2>&1 || true
|
||||
date +%s > "$WAKE_TS" 2>/dev/null || true
|
||||
exec /usr/bin/sxmo_wm.sh display on
|
||||
exec "$WM_CMD" display on
|
||||
;;
|
||||
cancel)
|
||||
# Called by the wake paths before they power the panel back on.
|
||||
"$LOCK_HELPER" cancel >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
printf 'Usage: %s [off|on]\n' "${0##*/}" >&2
|
||||
printf 'Usage: %s [off|on|cancel]\n' "${0##*/}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user