set the desktop wallpaper under Xfce4
You use the Xfce4 desktop environment (e.g. with Manjaro), and you want to change the desktop wallpaper from the command line.
Get the path of the current wallpaper:
$ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS-0/workspace0/last-image /trash/wallpapers/hd_wallpapers_forbackground_2015.jpg # sample output
Set the wallpaper to a new background image:
$ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS-0/workspace0/last-image -s PATH_OF_NEW_IMAGE
PATH_OF_NEW_IMAGE is the absolute path of the image you want to set (to avoid problems, use absolute paths).
(This paragraph is based on this post). How to list Xfce channels and their properties:
for channel in $(xfconf-query -l | grep -e '^\s'); do echo "Channel: $channel"; xfconf-query -c $channel -l; echo ''; done
This will give you a full listing of all the properties of each channel. You can query the value of a property this way:
xfconf-query -c <channel> -p <property>
I wanted to use this method on another machine of mine and it turned out that the property to be set is called differently! If I want to set the background, instead of
/backdrop/screen0/monitorLVDS-0/workspace0/last-image I had to set
/backdrop/screen0/monitorDVI-I-2/workspace0/last-image. Great :( So here is my updated method:
First, query all properties that end with “
$ xfconf-query -c xfce4-desktop -l | grep "last-image$"
Sample output on my machine:
/backdrop/screen0/monitor0/last-image /backdrop/screen0/monitorDVI-I-1/workspace0/last-image /backdrop/screen0/monitorDVI-I-1/workspace1/last-image /backdrop/screen0/monitorDVI-I-2/workspace0/last-image /backdrop/screen0/monitorDVI-I-2/workspace1/last-image
Then set the value of each of these properties to the absolute path of the background image.