Implementing optional rtc wakeup at regular intervals, added presuspend, rtcwake and postwake scripts (with hooks)

(includes missing return 0 statement caught by Serge Hallyn)

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
Maarten van Gompel 2020-07-27 00:23:28 +02:00
parent 5f5cc6e675
commit 642bf1cc27
4 changed files with 187 additions and 17 deletions

9
scripts/core/sxmo_postwake.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env sh
# This script is called when the system has successfully woken up after sleep
sxmo_statusbarupdate.sh
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/postwake" ]; then
"$XDG_CONFIG_HOME/sxmo/hooks/postwake"
fi

10
scripts/core/sxmo_presuspend.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env sh
# This script is called prior to suspending
# If this script returns a non-zero exit code, suspension will be cancelled
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/presuspend" ]; then
"$XDG_CONFIG_HOME/sxmo/hooks/presuspend"
exit $?
fi

11
scripts/core/sxmo_rtcwake.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env sh
# This script (and anything it calls) should return as quickly as possible
# as it blocks the system from suspending (and processing input) until done
# If this script returns a non-zero exit code, the system will wake up
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/rtcwake" ]; then
"$XDG_CONFIG_HOME/sxmo/hooks/rtcwake"
exit $?
fi