From 66174219bf03b2e33393e32d938b0dd499c70794 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sun, 25 Jul 2021 14:19:44 +0200 Subject: [PATCH] screenlock: Moved lock / unlock / screenoff hooks after the existing logic and set empty defaults Signed-off-by: Stacy Harper --- configs/default_hooks/lock | 2 +- configs/default_hooks/unlock | 5 +++-- scripts/core/sxmo_screenlock.sh | 16 ++++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/configs/default_hooks/lock b/configs/default_hooks/lock index ed69ecc..0a36f7b 100644 --- a/configs/default_hooks/lock +++ b/configs/default_hooks/lock @@ -1,3 +1,3 @@ #!/usr/bin/env sh -pkill -9 lisgd +# This hook is called when the system reaches a locked state diff --git a/configs/default_hooks/unlock b/configs/default_hooks/unlock index 558e2a2..e42ce51 100644 --- a/configs/default_hooks/unlock +++ b/configs/default_hooks/unlock @@ -1,4 +1,5 @@ #!/usr/bin/env sh -[ "$(xrandr | grep DSI-1 | cut -d ' ' -f 5)" = "right" ] && ORIENTATION=1 || ORIENTATION=0 -sxmo_hooks.sh lisgdstart -o $ORIENTATION & +# This hook is called when the system becomes unlocked again + +pkill -CONT conky diff --git a/scripts/core/sxmo_screenlock.sh b/scripts/core/sxmo_screenlock.sh index b651aa8..0bf9c66 100755 --- a/scripts/core/sxmo_screenlock.sh +++ b/scripts/core/sxmo_screenlock.sh @@ -83,13 +83,12 @@ if [ "$1" = "lock" ] ; then # always echo last state first so that user can use it in their hooks # TODO: Document LASTSTATE getCurState > "$LASTSTATE" - # Do we want this hook after disabling all the input devices so users can enable certain devices? - sxmo_hooks.sh lock #turn screen on xset dpms 0 0 0 xset dpms force on + # TODO: Could be improved by running xinput and disabling ALL input devices automatically but would need # to decide on the hook issues. Do we want a prelock and postlock? Or should users # be expected to edit the source code for disabling certain input devices? @@ -99,12 +98,14 @@ if [ "$1" = "lock" ] ; then killall lisgd updateLed + + # Do we want this hook after disabling all the input devices so users can enable certain devices? + sxmo_hooks.sh lock exit 0 elif [ "$1" = "unlock" ] ; then #normal unlocked state, screen on getCurState > "$LASTSTATE" - sxmo_hooks.sh unlock #turn screen back on xset dpms 0 0 0 @@ -112,17 +113,18 @@ elif [ "$1" = "unlock" ] ; then #start responding to touch input again xinput enable "$TOUCH_POINTER_ID" - sxmo_hooks.sh lisgdstart & + [ "$(xrandr | grep DSI-1 | cut -d ' ' -f 5)" = "right" ] && ORIENTATION=1 || ORIENTATION=0 + sxmo_hooks.sh lisgdstart -o "$ORIENTATION" & echo 16000 > "$NETWORKRTCSCAN" updateLed + + sxmo_hooks.sh unlock exit 0 elif [ "$1" = "off" ] ; then #locked state with screen off getCurState > "$LASTSTATE" - # TODO: document this hook - sxmo_hooks.sh screenoff #turn screen off, but have dpms temporarily enable #the screen when a button is pressed @@ -134,6 +136,8 @@ elif [ "$1" = "off" ] ; then killall lisgd updateLed + + sxmo_hooks.sh screenoff exit 0 elif [ "$1" = "crust" ] ; then getCurState > "$LASTSTATE"