Last updated: 7 Sep 23 18:23:22 (UTC)

Zenbook, go back to your bed right now!

Zenbook, go back to your bed right now! This belongs in /lib/systemd/system-sleep I upped the value from 2 seconds to 3, two suddenly wasn’t cutting it anymore.

#if you wake up, roll back over
#
#
SLEEPY_FILE=/root/.sleepy_time

case $1 in

    pre) date +%s > $SLEEPY_FILE  ;;

    post) 
    PREV_TIME=`cat $SLEEPY_FILE`
    NOW_TIME=`date +%s`
    SLEPT=$(( $NOW_TIME - $PREV_TIME ))
    echo $SLEPT
        if [ $SLEPT -lt 3  ] ; then
            /lib/systemd/system-sleep/kbd_light pre
            echo freeze > /sys/power/state
            /lib/systemd/system-sleep/kbd_light post

        fi
        ;;
esac


#Cannot systemctl suspend, I think it notices the re-entry and gets big mad.
#Since the whole systemctl pre-sleep scripts aren't being re-fired, this
#script here may only retry sleeping once. If that doesn't take, we're 
#staying awake.
#
#I should probably re-poke all of the sibling scripts, but mehhhhhh

#if you wake up, roll back over
#
#
SLEEPY_FILE=/root/.sleepy_time

case $1 in

    pre) date +%s > $SLEEPY_FILE  ;;

    post) 
    PREV_TIME=`cat $SLEEPY_FILE`
    NOW_TIME=`date +%s`
    SLEPT=$(( $NOW_TIME - $PREV_TIME ))
    echo $SLEPT
        if [ $SLEPT -lt 3  ] ; then
            /lib/systemd/system-sleep/kbd_light pre
            echo freeze > /sys/power/state
            /lib/systemd/system-sleep/kbd_light post

        fi
        ;;
esac


#Cannot systemctl suspend, I think it notices the re-entry and gets big mad.
#Since the whole systemctl pre-sleep scripts aren't being re-fired, this
#script here may only retry sleeping once. If that doesn't take, we're 
#staying awake.
#
#I should probably re-poke all of the sibling scripts, but mehhhhhh