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).
Even 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?
Best Answer
I think that should do the job
Use the following code to get the connected devices and count them:
then you have to manipulate over them and choose whether to set the value for image-path or last-image
Assume that 1.jpeg is any file just needed to create the string by default. And 2.png is the wanted picture to be set. I added the first line just to make sure that xfce4-desktop exists.
This script was tested in my machine and it is working well.
Hope that helps my friend
EDIT: A list of port names was found here like so:
For further Info check here