I'm using Backbox as main linux distro, but i hate that when i change the wallpaper, the login and splash screen background remains the same. So i made this script, in case that someone hates this too.
(tipe your username where specified)
#!/bin/bash
#get the file where i can find wallpaper's path
xfceFile=$(find /home/*PUT HERE YOUR USERNAME*/.config/ -name "xfce4-desktop.xml")
#get the right full wallpaper path from that file
wallpaper=$(grep -m 1 "image-path" $xfceFile | sed -n -e 's/.*value="//; s_"/>__p')
ext=$(echo $wallpaper | sed -n -e 's_.*\.__p')
#check if the wallpaper is already set or has to be updated
cmp -s $wallpaper /lib/plymouth/themes/backbox-logo/wallpaper.png
#here i check the exit status of cmp command to see the result of the comparison
if [ "$?" == "0" ]; then #same file, no need to update
exit 0
fi
#make a backup of the standard wallpaper
test -e /lib/plymouth/themes/backbox-logo/wallpaper.png.bak && echo "" || cp /lib/plymouth/themes/backbox-logo/wallpaper.png /lib/plymouth/themes/backbox-logo/wallpaper.png.bak
#remove the old one and put the current wall
rm /lib/plymouth/themes/backbox-logo/wallpaper.png
if [ "$ext" != "png" ]; then #if it's not a png file, convert it to png
convert $wallpaper $wallpaper.png
wallpaper=$wallpaper.png
fi
cp $wallpaper /lib/plymouth/themes/backbox-logo/wallpaper.png
rm $wallpaper 2>/dev/null #remove the temp png file if present (no output text)
update-initramfs -u
exit 0
I put it as shutdown and restart service. To do that just save it without extension, "chmod 755" it, put it in /etc/init.d, and then symlink it (ln -s *file* *destination*) to /etc/rc0.d/K90*filename* and /etc/rc6.d/K90*filename*. rc0 is for shutdown and rc6 for restart. K90 stands for KILL (it runs when closing the session) at 90 priority (pretty low priority).
Or you can make it start whenever the wallpaper is changed, as a thunar custom action...
Anyway... Did it for fun, more than other
Some interesting thinking was here. But on unix-like systems there is not much point to reinvent bicycle. But to simply set wallpaper on any DE/WM in unix like systems, tool as feh might work as charm with such easy and memorable command line
feh --bg-center /path/to/wallpaper.jpg
works with URL too
feh --bg-center http://someweb.com/wallpaper.jpg
Now this part of your code
xfceFile=$(find /home/*PUT HERE YOUR USERNAME*/.config/ -name "xfce4-desktop.xml")
I suggest you to use ~/ instead of /home/*PUT HERE YOUR USERNAME*/
since ~/ works like charm at solving that /home/username/ writing thing on probably all modern unix-like systems and all shells I ever tried. Which would make it look so much simpler
xfceFile=$(find ~/.config/ -name "xfce4-desktop.xml")
Of course some hardcore unix power users might disagree with my suggestion to use feh. But it's ok I havent faced any serious problems with that.
However I cannot understand all that additional hassle on setting wallpaper. But that's my personal opinion.
===================================================================================
EDIT------------
Oh I just checked what that backbox is. Now I see. Based on ubuntu? Now this explains this pointless additional level of complexity. And solution to non-existent problem. I would not recommend to use any distro like this one as your main. Go for somethin real, slackware or gentoo. Of course that's just my personal suggestion to you.
KISS - Keep it Simple Stupid