From 550fa7f18b021fef0437b8821b87c4b37c40cf66 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Tue, 22 Oct 2024 16:00:06 +0200 Subject: [PATCH] don't apply offset when screen is off --- ambientd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ambientd.c b/ambientd.c index 1745eba..7de75be 100644 --- a/ambientd.c +++ b/ambientd.c @@ -165,9 +165,14 @@ int main (void) actual_brightness = brightness_adjusted; } + // if the actual brightness is zero, it means that the screen is turned + // off for some reason, usually DPMS. As such it should not count for user + // offset. Look at the TODO file. + if (actual_brightness != 0) { off = actual_brightness - brightness_target; - if (brightness_target != max_brightness || off < 0){ - user_offset = off; + if (brightness_target != max_brightness || off < 0){ + user_offset = off; + } } // TODO: option to turn off logging