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:

  1. Several system calls that will be needed
  2. 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?


I think that should do the job

Use the following code to get the connected devices and count them:

connectedOutputs=$(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")
activeOutput=$(xrandr | grep -e " connected [^(]" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") 
connected=$(echo $connectedOutputs | wc -w)

then you have to manipulate over them and choose whether to set the value for image-path or last-image

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -n -t string -s  ~/Pictures/1.jpeg
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS1/workspace0/last-image -n -t string -s  ~/Pictures/1.jpeg

for i in $(xfconf-query -c xfce4-desktop -p /backdrop -l|egrep -e "screen.*/monitor.*image-path$" -e "screen.*/monitor.*/last-image$"); do
    xfconf-query -c xfce4-desktop -p $i -n -t string -s ~/Pictures/2.png  
    xfconf-query -c xfce4-desktop -p $i -s ~/Pictures/2.png


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:

Output port names

Intel driver - UMS

VGA - Analog VGA output

LVDS - Laptop panel

DP1 - DisplayPort output

TV - Integrated TV output

TMDS-1 - First DVI SDVO output

TMDS-2 - Second DVI SDVO output

The SDVO and DVO TV outputs are not supported by the driver at this time.

Intel driver - KMS

LVDS1 - Laptop panel

VGA1 - Analog VGA output

DVI1 - Digital video output

radeon driver

VGA-0 - Analog VGA output

LVDS - Laptop panel

S-video - Integrated TV output

DVI-0 - DVI output

For further Info check here

  • Why should that do the job? – Seth Feb 13 '14 at 17:29
  • @Seth Because I am looping through all available monitors and I will set the appropriate value for the found monitor. either last-image or image-path – kamil Feb 13 '14 at 17:31
  • In an newly installed XFCE system the values don't even exist. They are being created when you change once your desktop background manually. So, this isn't a good solution in my opinion. I include this answer in my question. I clearly say that I could try them all (create and change them every time), but this is far from being a good solution to the problem. – hytromo Feb 13 '14 at 19:09
  • you can create properties like you did – kamil Feb 14 '14 at 8:55
  • @hakermania check the edit – kamil Feb 14 '14 at 9:08

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.