danyspin97 / wpaperd

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

Randomize through folder without repeats #39

Closed daqnal closed 8 months ago

daqnal commented 1 year ago

Just a quick suggestion: Design some way for the random wallpaper sort to not repeat wallpapers until it has shown every one in the folder set by the user. One solution would be to initialize a randomized list of every wallpaper's index, then move through that list every next time wpaperd is run. Nice project 👍

danyspin97 commented 8 months ago

wpaperd now implements a queue and will try to draw images that have not drawn before when using Random sorting. I have added drawn_images_queue_size parameter to control how big this queue is, so you could have a big queue and avoid repeating images.

I am considering changing the parameter name to queue_size. What do you think? Does this cover your need?

Nama commented 8 months ago

Thank you!

Is the parameter really needed? Why not set it to amount of wallpapers in the folder?

danyspin97 commented 8 months ago

Yea, the parameter is needed because of how the queue work. The queue is a fixed size vector and needs to be reallocated when the size change. If the queue was the same size as the amount of wallpapers in the folder, I would need to reallocate it often depending on the user habits.

Personally, I think that setting that amount to a reasonable amount (like ~200) would have almost the same effect, due to randomness. It is also possible to set a higher number than the amount of wallpapers, achieving the effect mentioned.