https://bugs.kde.org/show_bug.cgi?id=480643

            Bug ID: 480643
           Summary: Optionally align slideshow timer with the beginning of
                    the day (sync multiple desktops)
    Classification: Plasma
           Product: plasmashell
           Version: 5.27.10
          Platform: unspecified
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Image Wallpaper
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
  Target Milestone: 1.0

SUMMARY
The wallpaper-image's slideshow timers are currently not synced between
multiple desktops. This is due to desktops on each screen+activity having their
own wallpaper configuration.

This causes issues though, which can be quite annoying. I think this could be
solved by a rather simple workaround.

Please hear me out:

Issue 1:
Since slideshow timers depend on each desktop separately, this in turn means
that slideshow times will only start when the desktop is shown/loaded for the
first time. If you have multiple activities set up with each desktop having the
same slideshow configuration applied, then the slideshow of the other
activities will only start when those activities are activated for the first
time, causing the wallpaper slideshow between those desktops to be out of sync.

Issue 2:
Similar to this, the slideshow timer starts on the first activity when the user
logs in, which is an arbitrary point in time. Imagine a slideshow configuration
where the image is supposed to change every 60 minutes. It would be nice to be
able to tell when a full hour mark has passed, just by looking at the wallpaper
on your second or third screen. This is currently only possible by timing the
exact moment when logging into the Plasma desktop session, namely at the full
hour mark. That slideshow timer value is of course just an example, but other
values like 10 minutes have exactly the same issue.

Proposed solution:
Add a checkbox to the slideshow configuration which aligns the first slideshow
timer with the beginning of the current day (or even 1970-01-01T00:00:00).
Either increase or decrease the timer of the first wallpaper, so that
wallpapers on all desktops where this option is enabled switch to the next
wallpaper exactly at the same time, regardless when the specific desktop was
loaded/activated for the first time. This implicitly fixes the desync issues
between multiple desktops on multiple screens and activities without having a
different synchronization mechanism implemented, and it also solves the second
issue I mentioned. For example, a timer of 60 minutes would only ever switch
the wallpaper at the full hour mark due to this option, and so would timers of
10 minutes, etc.

The calculation for that should be pretty straightforward. When starting the
desktop's first slideshow timer, simply calculate the passed time since
midnight of the current day (with the current timezone in mind) and then either
increase or decrease the timer by the timer offset (passed time modulo timer
duration):

```pseudo
diff = now - midnight_of_current_day;
offset = diff % timer_duration;

// make first timer longer
if (is_first_slideshow) timer_duration += timer_duration - offset;

// or make first timer shorter
if (is_first_slideshow) timer_duration -= offset;
```

Instead of just doing this for the first slideshow timer, this could of course
also be done for every slideshow timer. This would fix the issue of slideshows
becoming desynced on multiple screens on the same activity in certain cases
(different issue in regards to the transition/animation performance and
re-scheduling the timer after the transition has been completed).

I don't know C++ or Qt, and I also don't have any idea about the actual
implementation of the slideshow, but this is the relevant part in the
plasma-workspace repo:
https://invent.kde.org/plasma/plasma-workspace/-/blob/v5.27.10/wallpapers/image/plugin/imagebackend.cpp#L422

Thanks for considering this, I hope this makes sense.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.27.10 (irrelevant, also the case in today's 6.0-rc2)
KDE Frameworks Version: 5.114.0
Qt Version: 5.15.12

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to