Time Again for Tech Speak!

Ok, so today I set about trying to figure out how to get a rotating slideshow of desktop images when loading my Linux desktop in XFCE. I had an absolute BITCH of a time trying to find any information on this one that would help me out in getting this set up, but I eventually found a solution that worked! Since there isn’t any information on this elsewhere, I figure I’ll put it here!

For those out there who use the XFCE Desktop for Linux, you may have wanted to set up custom images in your desktop background. You may or may not have noticed that there isn’t an option to rotate the images, even though you have the ability to set up a list of images to choose from. Technically, any time that you restart your computer, an image will be selected randomly from the list. However, there isn’t a way to tell the computer to, say, load up a different image or do a slideshow or something like that.


So, I started to do some research on this, and came across information that indicated that I could set up a cron job that would refresh the environment for me, which would be just like restarting the computer… without having to restart the computer. XD The command runs something like this.

/usr/bin/xfdesktop –reload

And it worked! …..but only when I ran it from the command line. Running it from crontab wouldn’t work. Bummer. So, more research. Come to find out that cron jobs run in a slightly different environment and with slightly different access than the regular ol’ command line. My command turns into this…

DISPLAY=:0.0 /usr/bin/xfdesktop –reload

And THIS works on the command line too. Basically, all this does is tell the command what X display to use when running, but it still wouldn’t work in a cron job. Uggh… and I had such a hard time finding any information on what to do at this point.

I finally figured it out after referring to my notes from the Linux class that I’m taking that indicated you could grant certain access to the X server by using the `xhost` command. Alright, so I give it a try. I added the localhost, my normal user, and my root user to the list of approved hosts, set my crontab, and waited….

xhost +localhost;

xhost +SI:localuser:<username>;

crontab -e

*/5 * * * * DISPLAY=:0.0 /usr/bin/xfdesktop –reload

And it worked! Huzzah! All of the huzzahs! Hope that this proves helpful for any Linux users out there who couldn’t find information on doing this anywhere else. C: