diff options
author | Benjamin Berg <bberg@redhat.com> | 2020-11-23 13:33:09 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2021-01-11 21:05:03 +0000 |
commit | 58f7e05f5ade806a23ed8328e2bf9d465962469e (patch) | |
tree | a1ce527a1e47924f6e4927816f026e3e847d85cd | |
parent | e90a75fd59ac41aa331f53492a84712e43bcbce2 (diff) | |
download | gnome-settings-daemon-58f7e05f5ade806a23ed8328e2bf9d465962469e.tar.gz |
night-light: Move disable-until-tomorrow check to after active checkbenzea/night-light-570
When DUT is active (i.e. night light is effectively off), we should
still report the correct active state depending on whether we have
detected night-time or not.
So always run the code to update the active state, and instead only skip
the color temperature calculation that happens later.
Closes: #570
-rw-r--r-- | plugins/color/gsd-night-light.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/color/gsd-night-light.c b/plugins/color/gsd-night-light.c index 635f1608..f0eb2d5c 100644 --- a/plugins/color/gsd-night-light.c +++ b/plugins/color/gsd-night-light.c @@ -322,11 +322,6 @@ night_light_recheck (GsdNightLight *self) self->disabled_until_tmw = FALSE; g_clear_pointer(&self->disabled_until_tmw_dt, g_date_time_unref); g_object_notify (G_OBJECT (self), "disabled-until-tmw"); - } else { - g_debug ("night light still day-disabled, resetting"); - gsd_night_light_set_temperature (self, - GSD_COLOR_TEMPERATURE_DEFAULT); - return; } } @@ -343,6 +338,14 @@ night_light_recheck (GsdNightLight *self) return; } + gsd_night_light_set_active (self, TRUE); + + if (self->disabled_until_tmw) { + g_debug ("night light still day-disabled"); + gsd_night_light_set_temperature (self, GSD_COLOR_TEMPERATURE_DEFAULT); + return; + } + /* smear the temperature for a short duration before the set limits * * |----------------------| = from->to @@ -372,9 +375,9 @@ night_light_recheck (GsdNightLight *self) } else { temp_smeared = temperature; } + g_debug ("night light mode on, using temperature of %uK (aiming for %uK)", temp_smeared, temperature); - gsd_night_light_set_active (self, TRUE); gsd_night_light_set_temperature (self, temp_smeared); } |