AlfredoSequeida / venus

Venus aims to be a cross-platform tool to automatically change your desktop wallpaper to something random using images from Unsplash.
MIT License
25 stars 6 forks source link

Support for Linux Xfce4 #12

Open anfe0690 opened 4 years ago

anfe0690 commented 4 years ago

Hi, support for the Linux desktop environment Xfce4 is missing. Can we add it?

anfe0690 commented 4 years ago

I've created the pull request for this: #13

AlfredoSequeida commented 4 years ago

Hi, support for the Linux desktop environment Xfce4 is missing. Can we add it?

Definitely, I'll look into it or if you want - you're welcome to try and add support for it and submit a pull request.

anfe0690 commented 4 years ago

Definitely, I'll look into it or if you want - you're welcome to try and add support for it and submit a pull request.

Please take a look at the pull request: #13

AlfredoSequeida commented 4 years ago

Definitely, I'll look into it or if you want - you're welcome to try and add support for it and submit a pull request.

Please take a look at the pull request: #13

Awesome, sorry for the wait, I'll take a look at it.

AlfredoSequeida commented 4 years ago

Definitely, I'll look into it or if you want - you're welcome to try and add support for it and submit a pull request.

Please take a look at the pull request: #13

So I tested it on Xfce 4.14 and it didn't work for me. The good thing is that I know why.

Your current logic assumes that the property to set the wallpaper is that which contains last-image as the end of the property and is also the first occurrence since the for-loop breaks when it finds it.

for line in stdout.splitlines():
    if line.endswith("last-image"):
        subprocess.call(["xfconf-query", "--channel", "xfce4-desktop", "--property", line,"--set", picture_file], **silent)
        break

However, when I tried it, that was not the case for my system (tested using Linux mint 19.3). Monitoring Xfce for changes I noticed that the property used for setting the wallpaper for me was

/backdrop/screen0/monitoreDP-1/workspace0/last-image

and there were a few other properties that contained last-image when listing out all the properties prior to the one that worked to set the wallpaper.

To be more specific, the current logic is using the following property to set the wallpaper on my system which does not change the wallpaper:

/backdrop/screen0/monitor0/last-image

So, the logic needs to be updated so that it works with other configurations before It can be merged. The tricky part is figuring out how to distinguish between configurations so that Venus knows the property to set the image with since I suspect that it will be different based on versions of Xfce4 and monitor setups (currently only accounting for single monitor setups of course). I'll leave the logic up to you, but maybe looking at log files to see how the last image was set could work.