Creating a dynamic theme for Windows 7

If you want only the juicy part of this article, install the theme here

Windows 7 comes with a pretty neat theme manager, in which you can make your computer switch between a number of wallpapers on your drive or choose a theme you downloaded from Microsoft’s site (which comes with their own wallpapers too).

That’s fine enough if you have a lot of wallpapers and is okay with seeing about 10 different walls repeating from day to day… I don’t. That’s why I liked Bing Dynamic theme the most. What made this theme unique is, it fetches fresh wallpaper from Microsoft’s server everyday. This way I don’t have to see the same wallpapers over and over, and I don’t have to download the wallpapers first either. In case you didn’t know, downloading wallpapers is a tedious task:

  • It took at least two clicks from the wallpaper’s page to download the wallpaper you want (click download, choose the size).
  • You have to do this to each wallpaper you like.
  • You must have seen the wallpaper first, which ruins the surprise element.

The dynamic theme fixed those problems, you don’t have to do any browsing. The downside is, there’s only one such dynamic theme, and you can’t decide on the images. First, let’s have a look at the interesting part in the theme’s content (you can view the theme by opening it with notepad)

[Slideshow]
Interval=1800000
Shuffle=1
RSSFeed=http://themeserver.microsoft.com/default.aspx?p=Bing&c=Desktop&m=en-US
[boot]
SCRNSAVE.EXE=

You can see this theme fetches data from Microsoft’s server. It’s kinda RSS, but somewhat non-standard, Windows reads the enclosure element for the wallpaper instead of the link element like the standard (Microsoft loves breaking standards, this is why Internet Explorer is so hated among web developers).

Standard image RSS from NASA

<image xmlns:java_code="xalan://gov.nasa.build.Utils1"> 
    <url>http://www.nasa.gov/images/content/491481main_2010-5278-4x3_516-387.jpg</url> 
    <title>A Break in Training</title> 
    <link>http://www.nasa.gov/multimedia/imagegallery/index.html</link> 
    <description/> 
</image> 

Microsoft’s feed

        <item>
            <guid>Pipefish1920x120010-19-2010 7_57_11 PM3ed6bc33-88cb-4872-8097-5077cb6ad1a5</guid>
            <title>Pipefish1920x120010-19-2010 7_57_11 PM</title>
            <link ref="http://themeserver.microsoft.com/themeserver//Bing/Desktop/en-US/Images/Pipefish1920x120010-19-2010 7_57_11 PM.JPG" />
            <enclosure url="http://themeserver.microsoft.com/themeserver//Bing/Desktop/en-US/Images/Pipefish1920x120010-19-2010 7_57_11 PM.JPG" type="image/JPG" />
            <description>Picture for Bing, Desktop, en-US Theme.</description>
            <pubDate>10/19/2010 7:57:11 PM</pubDate>
        </item>

Actually, I think some engineer at Microsoft got mixed up between RSS (<item>) and Atom (<image>, <enclosure>) and created such an embarrassing feed. So you can’t just feed images from your favourite sites (like, cat images from flickr) right to your desktop.

Thankfully, we have just the tool for that: Yahoo pipes. It takes information from somewhere on the internet, transform it according to your specification, and is capable of exporting through RSS, JSON or PHP code.

So, I wanted to create a theme with images fed from xkcn.info (an image site about Vietnamese girls :p), I took the feed, feed it into the pipes. The pipes is a bit hard to use, because it cannot convert a XML element into string and vice versa, so you can’t just parse those neatly formatted elements but instead have to rely on the power of regular expression.

The pipe
  1. The first block fetches the feed
  2. The second block copy the data we need so we don’t mess up with existing stuff
  3. The third block removes all the text from the description and leaves only the first <img> tag
  4. The fourth block build a RSS feed formatted according to Microsoft “standard”

You can view the pipe here, and the RSS output of the pipe is here. So now all that remain is copy the Microsoft theme over, replace the feed URL and voilà, a more and more beautiful desktop everyday 😉

Desktop fully fed 😉

Download the theme here.

I have also created a Flickr-fed pipe and theme. To customize, clone the pipe, change it according to Flickr’s feed specification , modify the address in the theme to your pipe’s RSS output and you are set to go!

Leave a Reply

Your email address will not be published. Required fields are marked *