danyspin97 / wpaperd

Modern wallpaper daemon for Wayland
GNU General Public License v3.0
332 stars 26 forks source link

Previous wallpaper #38

Closed Rolv-Apneseth closed 1 year ago

Rolv-Apneseth commented 1 year ago

Continuation of #36, in relation to #34

Apologies as I had to sync my main branch with this repo and that force closed that last pr.

This isn't finished yet as I am currently facing a bug, and am opening this now to ask for some help, if you have time.

The problem is that when wpaperctl previous-wallpaper is called, the wallpapers stop changing on the timer and I can't seem to figure out why, probably because I can't quite get my head around how everything is working under the hood. Maybe you can see an issue I'm just completely missing?

anoldguy commented 1 year ago

Testing this, I see that it's something to do with the duration. Specifically, if you set the duration to something low, like 10s, you can easily see what I describe.

  1. Start the daemon with wpaperd -v -n. Watch it sort thru a couple screens
  2. Issue wpaperctl previous-wallpaper. Watch the previous wallpaper appear.
  3. Wait. And wait. (It will stick here forever)
  4. Issue another wpaperctl previous-wallpaper. Watch the previous-previous wallpaper appear!
  5. Watch the rotation continue as normal, every 10s.
  6. Issue another wpaperctl previous-wallpaper. :boom: you're back to step 3. Rinse, repeat.

I don't know why this is yet, but in order to kick it loose again, you have to wait until your OG duration has expired. It's easy to test with a 10s duration.

I think it's because we're somehow not scheduling a new timeout event, so when we issue wpaperctl previous-wallpaper, the code that checks duration to see if we're at 0, which we're not, so it never updates and sets a new duration.

We break out of that by sending another event, and since our duration is now 0, since the 10s have expired, everything is happy.

But. I don't know how to fix it. :thinking: Yet.

Rolv-Apneseth commented 1 year ago

Hey @danyspin97, any idea what could be causing the issue here?

danyspin97 commented 1 year ago

Hey @Rolv-Apneseth, @anoldguy . I think this might be an issue with the timer in general, since it is happening in a different way with the command next-wallpaper. I am currently working on finalizing the openGL implementation of wpaperd, I'll have a look at this bug afterwards.

Since this bug is not related to this PR per se, for me it's okay to merge it and look for the bug afterwards. Would that be okay for you?

Rolv-Apneseth commented 1 year ago

If you wish to just have a look at it afterwards then yeah that's completely fine by me

danyspin97 commented 1 year ago

Let's merge it for now. I will be in vacation for the next week so I won't be able to fix the issue :(

Thank you @Rolv-Apneseth for working on this and @anoldguy for providing testing and feedback :)

Rolv-Apneseth commented 1 year ago

All good, have a nice vacation