Command to change the wallpaper in XUbuntu

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

done

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