Bug 477482

Summary: Transition to Night Light mistaken as transition to Day Light in new Brightness and Color applet
Product: [Plasma] plasmashell Reporter: Nate Graham <nate>
Component: Power and Battery widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: isma.af, kde, me, natalie_clarius
Priority: NOR Keywords: qt6, regression
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Mis-identified, causing wrong strings and icons
My settings
Two independent applets on the same system

Description Nate Graham 2023-11-25 00:05:59 UTC
Created attachment 163438 [details]
Mis-identified, causing wrong strings and icons

With the new applet, the period when Night Light begins its evening transition is mis-identified in the applet as a transition to Day Color. See attached screenshots of the applet and my settings in System Settings.
Comment 1 Nate Graham 2023-11-25 00:06:33 UTC
Created attachment 163439 [details]
My settings
Comment 2 Natalie Clarius 2023-11-25 16:34:45 UTC
Can not reproduce.

What does

> qdbus org.kde.NightColor /ColorCorrect org.kde.kwin.ColorCorrect.daylight

say?
Comment 3 Nate Graham 2023-11-25 20:58:31 UTC
Right now, or when the problem is reproducing?

Right now (when the problem is not reproducing):
> qdbus org.kde.NightColor /ColorCorrect org.kde.kwin.ColorCorrect.daylight
> true
Comment 4 Natalie Clarius 2023-11-25 22:08:25 UTC
When the problem is reproducing I mean.

And right now it correctly shows day?

Can you also check next time you see the wrong time info whether the color temperature is what it should be; e.g. if it is shortly before the end of transition time it should be close to night color temperature.
Comment 5 Ismael Asensio 2023-11-25 23:44:44 UTC
Created attachment 163482 [details]
Two independent applets on the same system

I've found that the behavior is different (and continues to be so) depending on when the applet starts:
- if the applet comes from daytime into the transition then it may exhibit the bug saying Day/Morning transition
- if the applet is started after the transition or in night period, then it shows the right Nigh/Evening transition

The attachment shows two simultaneous applets, but started at different times.

I used manual location to play with the night times, because I couldn't reproduce the bug using custom timings. (Of course it could also be some initialization issue so it is random and I'm trying to look for patterns here)
Comment 6 Natalie Clarius 2023-11-26 00:02:48 UTC
(In reply to Ismael Asensio from comment #5)
> Created attachment 163482 [details]
> Two independent applets on the same system
> 
> I've found that the behavior is different (and continues to be so) depending
> on when the applet starts:
> - if the applet comes from daytime into the transition then it may exhibit
> the bug saying Day/Morning transition
> - if the applet is started after the transition or in night period, then it
> shows the right Nigh/Evening transition
> 
> The attachment shows two simultaneous applets, but started at different
> times.
> 
> I used manual location to play with the night times, because I couldn't
> reproduce the bug using custom timings. (Of course it could also be some
> initialization issue so it is random and I'm trying to look for patterns
> here)

Good find. And by "applet started" you mean when you clicked on it so it would expand?
Comment 7 Natalie Clarius 2023-11-26 00:21:57 UTC
Aha, the DBus interface from KWin doesn't include daylight in the properties changed. Now I just need to understand what to do to change this.
Comment 8 Ismael Asensio 2023-11-26 00:24:33 UTC
(In reply to Natalie Clarius from comment #6)
> (In reply to Ismael Asensio from comment #5)
> > Created attachment 163482 [details]
> > Two independent applets on the same system
> > 
> > I've found that the behavior is different (and continues to be so) depending
> > on when the applet starts:
> > - if the applet comes from daytime into the transition then it may exhibit
> > the bug saying Day/Morning transition
> > - if the applet is started after the transition or in night period, then it
> > shows the right Nigh/Evening transition
> > 
> > The attachment shows two simultaneous applets, but started at different
> > times.
> > 
> > I used manual location to play with the night times, because I couldn't
> > reproduce the bug using custom timings. (Of course it could also be some
> > initialization issue so it is random and I'm trying to look for patterns
> > here)
> 
> Good find. And by "applet started" you mean when you clicked on it so it
> would expand?

I launched two different instances using plasmoidviewer, but at different times.
(I was very bad at explaining it, and the cut of the screenshot didn't help.)

With some more testing and checking the output of "qdbus org.kde.NightColor /ColorCorrect org.kde.kwin.ColorCorrect.daylight", it looks like  the daylight property is not always updated by the applet or the plugin's monitor.
Comment 9 Ismael Asensio 2023-11-26 00:28:15 UTC
(In reply to Natalie Clarius from comment #7)
> Aha, the DBus interface from KWin doesn't include daylight in the properties
> changed. Now I just need to understand what to do to change this.

Good! That really looks like it. 

(I wrote the previous message before reading this one, but it seems to confirm your findings)
Comment 10 Natalie Clarius 2023-11-26 01:33:22 UTC
It was a stupid copy-paste error
Comment 11 Bug Janitor Service 2023-11-26 01:33:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4714
Comment 12 Natalie Clarius 2023-11-26 11:57:20 UTC
Git commit 99ff31d3ab93f8c7b7a057369813f7797af3bf0a by Natalie Clarius.
Committed on 26/11/2023 at 12:49.
Pushed by nclarius into branch 'master'.

plugins/nightcolor: fix wrong changed property insert in DBus interface

M  +1    -1    src/plugins/nightcolor/nightcolordbusinterface.cpp

https://invent.kde.org/plasma/kwin/-/commit/99ff31d3ab93f8c7b7a057369813f7797af3bf0a