One Wallpaper/Background per desktop/workspace in Ubuntu with Icons

It seems the current best solution with respect to multiple wallpapers involves giving up desktop icons. I’ve written a rather hackish alternative, which instead gives up instantaneous transitions between one wallpaper and the next (they now take about half a second). The code is reproduced below, but I recommend grabbing the original here (which preserves pretty indentation).

# written Joseph Bylund, 2011/10/12
# this script watches for desktop changes, and when it finds one it changes the background. Currently this is a hackjob, but it
# should work if you fix the paths and number the files you'd like to use as 1.jpg, 2.jpg, 3.jpg (for workspaces 1,2,3
# respectively). You can even use xml files as per the cosmos background as your backgrounds, just rename to 1.xml,
# 2.xml ... You'll also have to change the extension to xml from jpg.
# also update the path_to_bg_files to where you're keeping your background files.

use strict;

use Time::HiRes qw( nanosleep );

my $extension = "jpg";

my $user = `whoami`;

my $path_to_bg_files = "/home/$user/Desktop/multi_wallpaper_test";

my $workspace_width = `wmctrl -d|head -n 1`;
$workspace_width =~ s/.*WA: [^ ]* //;
$workspace_width =~ s/x.*//;
$workspace_width = int($workspace_width);
print "width = $workspace_width\n";

my $window_manager = &get_window_manager;
print "using $window_manager\n";
my $last_workspace = &get_workspace($window_manager,$workspace_width);
my $current_workspace = $last_workspace;

my $counter = 0;

$current_workspace = &get_workspace($window_manager,$workspace_width);
if($current_workspace != $last_workspace)
$last_workspace = $current_workspace;
system("gconftool --type string --set /desktop/gnome/background/picture_filename \"$path_to_bg_files/$current_workspace.${extension}\"");
nanosleep(int(0.5*10^9)); # increase sleep timer to reduce cpu usage, decrease to improve response time

sub get_workspace
my $window_manager = shift;
my $workspace_width = shift;
my $current_workspace;
if($window_manager eq "metacity")
$current_workspace = `wmctrl -d|grep \\*`;
$current_workspace =~ s/.*Workspace//g;
$current_workspace =~ s/\s*//g;
my $current_vp = `wmctrl -d`;
$current_vp =~ s/.*VP: //;#cut off leading
$current_vp =~ s/,.*//;#cut off trailing
$current_workspace = $current_vp/$workspace_width + 1;

sub get_window_manager
my $lines = `wmctrl -d|wc -l`;
if($lines > 1)


Live Background of the Earth on Ubuntu (or any other Gnome linux for that matter)

Ever wanted to have a live background of the earth on ubuntu. Well here’s how.
1) Get some background images, I put the ones I use at the end of this post.
2) Get a cloud map, I put this in a cronjob in order to make it refresh every hour or so. Now you can use your background as a weather report!
wget -N -O /home/user/.xplanet/images/clouds_4096.jpg
I use the -N here to make sure I’m not loading the server unnecessarily, but there’s also no reason to put it in your crontab at too high a frequency.
3) Use xplanet to make a background (I put the latitude and longitude to center the image on NYC (home for me), so I suggest you change that.
xplanet –latitude 40 –longitude -73.961506 –conf /home/user/.xplanet/overlay_clouds –output /home/user/Pictures/world.jpg –verbosity 4 –geometry 4096×2048 –num_times 1
4) Put the cloud getting and the earth drawing in a cronjob, and set your desktop background to the output image. Gnome will check if the image changes, and update your background when the file changes. Awesome.

And overlay_clouds looks like this:
map=/home/user/.xplanet/images/earth_4096_l.jpg # This image needs to be cloud-free
night_map=/home/user/.xplanet/images/night_4096.png # This image needs to be cloud-free

Then for maps here are mine, but I recommend checking out what you can find. I might switch to using this one,, for which I’d probably get the 5k wide image and scale down a bit. Everything works best if you scale all images to the same size before giving them to xplanet. That’s why I use 4096, because it’s the highest res cloud map I can find.