feat(x11): disable X screensaver/DPMS blanking and enforce explicit-only locking
This commit is contained in:
@@ -15,43 +15,8 @@ fi
|
||||
SXMO_SUSPENDABLE_STATES="${SXMO_SUSPENDABLE_STATES:-screenoff 3}"
|
||||
|
||||
transition_can_suspend() {
|
||||
# shellcheck disable=SC2086
|
||||
set -- $SXMO_SUSPENDABLE_STATES
|
||||
|
||||
tmpstate=
|
||||
timeout=
|
||||
while [ $# -gt 0 ]; do
|
||||
if [ "$1" = "$state" ]; then
|
||||
tmpstate="$1"
|
||||
timeout="$2"
|
||||
break
|
||||
fi
|
||||
shift 2
|
||||
done
|
||||
|
||||
stop_idle_suspender() {
|
||||
sxmo_jobs.sh stop idle_suspender
|
||||
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
||||
}
|
||||
|
||||
if [ -z "$tmpstate" ]; then
|
||||
sxmo_log "this state is not suspendable"
|
||||
stop_idle_suspender
|
||||
return
|
||||
fi
|
||||
|
||||
case "$timeout" in
|
||||
''|*[!0-9]*)
|
||||
sxmo_log "there is no valid suspendable timeout for this state"
|
||||
stop_idle_suspender
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
sxmo_log "idle suspender started with timeout $timeout"
|
||||
sxmo_jobs.sh start idle_suspender sxmo_idle.sh -w \
|
||||
timeout "$timeout" 'sxmo_wakelock.sh unlock sxmo_not_suspendable' \
|
||||
resume 'sxmo_wakelock.sh lock sxmo_not_suspendable infinite'
|
||||
sxmo_jobs.sh stop idle_suspender 2>/dev/null || true
|
||||
sxmo_wakelock.sh lock sxmo_not_suspendable infinite 2>/dev/null || true
|
||||
}
|
||||
|
||||
transition() {
|
||||
@@ -104,22 +69,9 @@ click() {
|
||||
}
|
||||
|
||||
idle() {
|
||||
count="${1:-1}"
|
||||
# shellcheck disable=SC2086
|
||||
set -- $SXMO_STATES
|
||||
while [ $# -gt 1 ]; do
|
||||
if [ "$1" = "$state" ]; then
|
||||
if [ "$count" -ge "$#" ]; then
|
||||
count=$(($# - 1))
|
||||
fi
|
||||
shift "$count"
|
||||
transition "$1"
|
||||
return
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
sxmo_log "idle: not transitioning from $state"
|
||||
sxmo_jobs.sh stop idle_locker 2>/dev/null || true
|
||||
sxmo_jobs.sh stop idle_suspender 2>/dev/null || true
|
||||
sxmo_log "idle: automatic idle locking is disabled"
|
||||
}
|
||||
|
||||
store() {
|
||||
|
||||
Reference in New Issue
Block a user