screenlock: Moved lock / unlock / screenoff hooks after the existing logic and set empty defaults

Signed-off-by: Stacy Harper <contact@stacyharper.net>
master
Maarten van Gompel 3 years ago committed by Stacy Harper
parent 2b5f2b97e7
commit 66174219bf
No known key found for this signature in database
GPG Key ID: 5BAC92328B7C5D65
  1. 2
      configs/default_hooks/lock
  2. 5
      configs/default_hooks/unlock
  3. 16
      scripts/core/sxmo_screenlock.sh

@ -1,3 +1,3 @@
#!/usr/bin/env sh #!/usr/bin/env sh
pkill -9 lisgd # This hook is called when the system reaches a locked state

@ -1,4 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
[ "$(xrandr | grep DSI-1 | cut -d ' ' -f 5)" = "right" ] && ORIENTATION=1 || ORIENTATION=0 # This hook is called when the system becomes unlocked again
sxmo_hooks.sh lisgdstart -o $ORIENTATION &
pkill -CONT conky

@ -83,13 +83,12 @@ if [ "$1" = "lock" ] ; then
# always echo last state first so that user can use it in their hooks # always echo last state first so that user can use it in their hooks
# TODO: Document LASTSTATE # TODO: Document LASTSTATE
getCurState > "$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 #turn screen on
xset dpms 0 0 0 xset dpms 0 0 0
xset dpms force on xset dpms force on
# TODO: Could be improved by running xinput and disabling ALL input devices automatically but would need # 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 # 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? # be expected to edit the source code for disabling certain input devices?
@ -99,12 +98,14 @@ if [ "$1" = "lock" ] ; then
killall lisgd killall lisgd
updateLed updateLed
# Do we want this hook after disabling all the input devices so users can enable certain devices?
sxmo_hooks.sh lock
exit 0 exit 0
elif [ "$1" = "unlock" ] ; then elif [ "$1" = "unlock" ] ; then
#normal unlocked state, screen on #normal unlocked state, screen on
getCurState > "$LASTSTATE" getCurState > "$LASTSTATE"
sxmo_hooks.sh unlock
#turn screen back on #turn screen back on
xset dpms 0 0 0 xset dpms 0 0 0
@ -112,17 +113,18 @@ elif [ "$1" = "unlock" ] ; then
#start responding to touch input again #start responding to touch input again
xinput enable "$TOUCH_POINTER_ID" 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" echo 16000 > "$NETWORKRTCSCAN"
updateLed updateLed
sxmo_hooks.sh unlock
exit 0 exit 0
elif [ "$1" = "off" ] ; then elif [ "$1" = "off" ] ; then
#locked state with screen off #locked state with screen off
getCurState > "$LASTSTATE" getCurState > "$LASTSTATE"
# TODO: document this hook
sxmo_hooks.sh screenoff
#turn screen off, but have dpms temporarily enable #turn screen off, but have dpms temporarily enable
#the screen when a button is pressed #the screen when a button is pressed
@ -134,6 +136,8 @@ elif [ "$1" = "off" ] ; then
killall lisgd killall lisgd
updateLed updateLed
sxmo_hooks.sh screenoff
exit 0 exit 0
elif [ "$1" = "crust" ] ; then elif [ "$1" = "crust" ] ; then
getCurState > "$LASTSTATE" getCurState > "$LASTSTATE"

Loading…
Cancel
Save