Doing a google search reveals the command
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s <image-path>
The first time I run this command I got a message saying that the property /backdrop/screen0/monitor0/image-path does not exist in channel xfce4-desktop.
So, I created this property:
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -n -t string -s <image-path>
But still the background didn't change.
I then changed the background from space-03.jpg to space-04.jpg normally, from the Desktop Settings application of XUbuntu. Then I run:
$ xfconf-query -c xfce4-desktop -p /backdrop -lv /backdrop/screen0/image-path /usr/share/backgrounds/space-03.jpg /backdrop/screen0/monitor0/image-path /usr/share/backgrounds/space-03.jpg /backdrop/screen0/monitor0/image-show true /backdrop/screen0/monitor1/image-path /usr/share/backgrounds/space-03.jpg /backdrop/screen0/monitor1/image-show true /backdrop/screen0/monitorLVDS1/workspace0/color-style 0 /backdrop/screen0/monitorLVDS1/workspace0/image-style 5 /backdrop/screen0/monitorLVDS1/workspace0/last-image /usr/share/backgrounds/space-04.jpg
As you can see, the property
/backdrop/screen0/monitorLVDS1/workspace0/last-image has changed (!).
If I change this property then it works just fine but the thing is that I need to find a general way in order to implement it in my program (Wallch).
Variety (which is a very nice program, by the way) does not work properly on my machine and chooses to change the property
/backdrop/screen0/monitor0/image-path which does nothing.
One way would be to create all the possible properties and change all of them when needed, simultaneously. I don't like this solution because of 2 reasons:
- Several system calls that will be needed
- At one point I will need to take the current image's path (in order to open the folder of it, copy the path of it, delete it and some other functions that the program provides). I would not know which property holds the path of the truly set image in order to make it available to the program.
I also do not understand why XFCE has done it so complex. Why wouldn't one property be enough like in gsettings?