From c465cb08b0fd5cb6c141ddeff471e172ea886396 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 12 Jan 2022 17:45:15 +0200 Subject: Added a before_suspend "hook" to lock script --- .i3lock/lock.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '.i3lock') diff --git a/.i3lock/lock.sh b/.i3lock/lock.sh index 9ec6d4c..4d0b4b0 100755 --- a/.i3lock/lock.sh +++ b/.i3lock/lock.sh @@ -18,6 +18,11 @@ before_locking () { dunstctl set-paused true } +before_suspend () { + # Keep track of time when machine is suspended, as well as how long it has been up for + uptime >> ~/.i3lock/suspend-history +} + when_unlocked () { dunstctl set-paused false # Enables my notification daemon @@ -83,6 +88,8 @@ fi # ++=========++ if [[ "$1" == 'suspend' ]]; then + before_suspend + # A file is created to indicate that the system was suspended # After i3lock is done (unlocked), existence of this file is checked to determine if # script should run when_unlocked_after_suspend function -- cgit v1.2.3