From 48aaf76c8a5e66ed84402c09482e9352b3ca1198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 21 Aug 2020 10:35:05 +0200 Subject: [PATCH] Fix busy loop (sleep wouldn't be triggered when the display is off) --- afterlock/afterlock.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/afterlock/afterlock.go b/afterlock/afterlock.go index 74360aa..001cace 100644 --- a/afterlock/afterlock.go +++ b/afterlock/afterlock.go @@ -112,15 +112,15 @@ func (af *AfterLock) hybernateDisplayLoop() { if err != nil { panic(err) } - for { - time.Sleep(time.Duration(af.LoopDelay) * time.Second) - if af.keypressFlag.Get() { - af.keypressFlag.Set(false) - continue - } else { - break - } + } + + for { + time.Sleep(time.Duration(af.LoopDelay) * time.Second) + if af.keypressFlag.Get() { + af.keypressFlag.Set(false) + continue } + break } } } \ No newline at end of file