#
# define xfce4 xml file that holds info about desktops
#
DESKTOP="/home/$(id -un)/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml"
#
# define xpath that will extract current desktop background file name
# (NB I am no expert in xpaths and there is probably a much more elegant way
# to do this but this works for me)
#
XPATH='(//property[@name="workspace0"]/property[@name="last-image"])[last()]/@value'
#
# use xmllint utility to apply xpath to file and extract file path and name
#
IMAGE=$(xmllint --xpath "string(${XPATH})" "${DESKTOP}")
#
# display the file info extracted
#
echo Current Wallpaper File = ${IMAGE}
#
# rest of script........
#