Configurable screen blank (default 5 min), instant lock/lid blank, instant call/SMS wake

- Config -> Screen blank submenu (Off / 30 s / 1 / 5 / 10 / 30 min) backed by
  ~/.config/sxmo/idle_blank_timeout and the new bananarchy-idle-timeout.sh
  get|label|set. Default changed from 60 s to 300 s. dwm reads the file live
  and reloads it on SIGUSR1, so a menu change takes effect without a restart;
  sxmo.noidle and SXMO_UNLOCK_IDLE_TIME still override/disable it.
- Power -> Lock now uses @plugin:locker:screenoff (like Lock (Screen off)), and
  lock_phone_screenoff() resets dwm's idle state, so closing the slider/lid or
  locking blanks the panel immediately instead of waiting for the timeout.
- New bananarchy-screen-wake.sh restores the panel via sxmo_wm.sh display on,
  records /tmp/bananarchy_last_wake and signals dwm (SIGUSR1) to reset
  idle_blanked / last_input_ms. Called from sxmo_hook_ring.sh (incoming call)
  and sxmo_hook_notification.sh (SMS / notifications). dwm also self-heals if
  an external hook turns the panel on without a signal.

Verified live on the connected phone (after deploying the rebuilt dwm/dmenu
and restarting dwm with a rollback backup): idle_locker job is gone, default
reads 300 / 5m, setting 10 s blanks the panel (br 14->0, bl 0->4, DPMS On->Off)
after ~14 s of no input, and bananarchy-screen-wake.sh restores it immediately.
Lock state and 5-minute default were restored afterwards. All scripts pass sh -n.

Rebuilt dwm/dmenu and images/bananarchy-nokia-argon.img with --mkinitfs;
boot.img still contains the known-good zImage + DTB byte-for-byte.
check-rebuild.sh passes and artifact drift is 0.

Docs: MANUAL.md, CHANGELOG.md, AGENTS.md, BATTERY-OPTIMIZATION-ANALYSIS.md (13).
This commit is contained in:
Bantam committed 2026-11-07 18:16:26 +02:00
1 parent 22d629f59b
commit da68bb8c60
14 files changed
+226 -12

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
#!/bin/sh
# Get or set the unlocked idle screen-blank timeout (seconds).
# Config menu -> "Screen blank" writes ~/.config/sxmo/idle_blank_timeout.
# 0 disables blanking; dwm reloads the file on SIGUSR1.
CFGDIR="${XDG_CONFIG_HOME:-${HOME:-/home/user}/.config}/sxmo"
CFG="$CFGDIR/idle_blank_timeout"
DEFAULT=300
get_secs() {
v="$DEFAULT"
if [ -r "$CFG" ]; then
read -r v < "$CFG" 2>/dev/null || v="$DEFAULT"
fi
case "$v" in ''|*[!0-9]*) v="$DEFAULT" ;; esac
printf '%s\n' "$v"
}
label() {
v="$(get_secs)"
if [ "$v" -le 0 ]; then
printf 'Off\n'
elif [ "$v" -lt 60 ]; then
printf '%ss\n' "$v"
elif [ $((v % 60)) -eq 0 ]; then
printf '%sm\n' "$((v / 60))"
else
printf '%sm%ss\n' "$((v / 60))" "$((v % 60))"
fi
}
notify_dwm() {
p="$(pidof -s dwm 2>/dev/null || true)"
[ -n "$p" ] && kill -USR1 "$p" 2>/dev/null || true
}
case "${1:-get}" in
get)
get_secs
;;
label)
label
;;
set)
v="${2:-}"
case "$v" in ''|*[!0-9]*)
printf 'Usage: %s [get|label|set <seconds>]\n' "${0##*/}" >&2
exit 1
;;
esac
[ "$v" -le 86400 ] || v=86400
mkdir -p "$CFGDIR" 2>/dev/null || true
printf '%s\n' "$v" > "$CFG" || exit 1
notify_dwm
printf '%s\n' "$v"
;;
*)
printf 'Usage: %s [get|label|set <seconds>]\n' "${0##*/}" >&2
exit 1
;;
esac
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
# Wake the screen for an external event (incoming call / SMS / notification)
# and reset dwm's idle-blank timer so it cannot blank again immediately.
export DISPLAY="${DISPLAY:-:0}"
/usr/bin/sxmo_wm.sh display on >/dev/null 2>&1 || true
date +%s > /tmp/bananarchy_last_wake 2>/dev/null || true
p="$(pidof -s dwm 2>/dev/null || true)"
[ -n "$p" ] && kill -USR1 "$p" 2>/dev/null || true
exit 0
Binary file not shown.
Binary file not shown.
@@ -52,6 +52,9 @@ fi
printf '%s\n' "$now_ts" > "$STAMP_FILE"
exec 8>&-
# SMS / notification: turn the panel on immediately and reset the idle timer.
/usr/bin/bananarchy-screen-wake.sh >/dev/null 2>&1 || true
if [ -f "$XDG_CONFIG_HOME/sxmo/ringsettings" ]; then
# shellcheck disable=SC1091
. "$XDG_CONFIG_HOME/sxmo/ringsettings"
@@ -12,6 +12,9 @@
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME:-/home/user}/.config}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
# Incoming call: turn the panel on immediately and reset the idle timer.
/usr/bin/bananarchy-screen-wake.sh >/dev/null 2>&1 || true
if [ -z "${SXMO_VIBRATE_DEV:-}" ] && [ ! -e /dev/input/by-path/platform-vibrator-event ]; then
for vdev in /dev/input/by-path/*vibrator*-event; do
if [ -e "$vdev" ]; then