I didn’t like a lot of the official background changers out there for Ubuntu + Gnome.
The best one that I tried was Desktop Drapes and it just wasn’t stable for me.
I also thought that having a program constantly running to change my desktop background was a little excessive.
So I wrote a little switcher in perl. I used perl because I wanted to make sure that the desktop actually switched each time (i.e., no direct repeats) and I felt that perl was better for this than a shell script.
I had to go the symbolic link route because Gnome requires DBUS_SESSION_BUS_ADDRESS to be set, it’s only set in the environment of your X session, and there was no (good) way to extract that via cron. Which is why you always see bg changers outside of cron.
The usage is pretty straight forward:
randombg.pl <directory>
Where <directory> is where your backgrounds are located.
Note 1: <directory> defaults to ~/Pictures, so if that’s where you have your backgrounds then you don’t need to send a command line to it).
Note 2: this will create a symbolic link called background.jpg in your picture directory, so make sure that file doesn’t already exist.
I then set this up in cron:
0-59/15 * * * * ~/scripts/randombg.pl
That swaps out my background every 15 minutes.
You can download randombg.pl.gz here
0 Comments.