Tag Archives: HTC

Conky Bling

It can be tough running an RCSL distro as your main desktop: it might be nicely stable -and thank heavens it’s Gnome 2, not Gnome 3! But it can be just a tad boring.

In particular, I miss having a nice, big, glossy clock to tell me the time (the textual one in the Gnome 2 top panel is tiny!). I also quite like to know whether it’s going to rain over the next couple of days …so some sort of weather forecast display would be good, too. If you could then wrap it all up in HTC Desire-like sexiness, that would be just perfect! A bit like that graphic you see on the left, then?! Indeed.

Windows 7 has desktop gadgets to achieve that. RCSL has… well, nothing really.

Of course, if you install any recent version of the Opera browser, even on Linux and even on RCSL distros, it comes with a ‘widget engine’ that allows desktop applications -like clocks and calendars- to run independently (i.e., although Opera has to be installed, it doesn’t have to be running for these widgets to run). You can get some quite glossy weather, clock and calendar widgets that bling things up nicely. However, there’s no way to get them to autostart each time you reboot your box (which is a big omission as far as I am concerned). Additionally, they create an entry in Gnome 2′s bottom panel -which starts getting a bit cluttered very early on in the piece as a result. So Opera widgets are not, for me, the way to go.

No, the way to go is… (drum roll, please): Conky. It’s been around for ages (and I’ve documented getting it to work before, many moons ago), but it’s a tad tricky to get it working on an RCSL distro. Therefore, I’ve done what I always do when something is tricky: I script it within an inch of its life so that with one command, everything gets done automatically.

1. Getting your Weather Service sorted

Before you do anything else, if you’re going to display weather forecasts, you need online access to a weather service. The Weather Channel seems to be the standard way of doing that these days and, despite appearances and the language used (“subscription”!!), it seems to be an entirely zero cost option (provided you don’t make more than 100 enquiries of the service per day). So visit http://www.weather.com/services/xmloap.html, click on the Subscribe button and prepare to part with your personal details, but zero cash, to create a Weather Channel API account.

You’ll be sent an email to activate your new account: click on the link it provides. Some minutes after activation, you’ll be sent another email containing a ‘magic key’. You will need this long, random string of hex characters shortly, as you’ll see.

Independent of all that, you also need to find out your home town’s Weather Channel code: visit www.weather.com and use the search panel to locate somewhere suitable. If you find the right place, you should be taken to a URL that reads something like: http://www.weather.com/weather/today/ASXX0022 …and your ‘town code’ is that last bit. So, in my case, Campbelltown, Australia is code ASXX0022. Remember that information, because you’ll need that shortly, too!

2. The Automated Bit

As yourself (not as root), run these commands in a terminal window

wget http://dl.dropbox.com/u/30619235/conky/dzconky.sh
chmod 775 dzconky.sh
./dzconky.sh <username>

That downloads a very small shell script, makes it executable and then runs it. Note that when you run it, you have to say which user is to be configured for this desktop bling makeover. So you can run this script as, say, user “hjr” and yet configure the desktop for user “dizwell”.

Since I’m configuring my own desktop, my last command above would simply be:

./dzconky.sh hjr

At this point, you’ll be asked to supply the root password -and then about 15MB of stuff will get downloaded, installed, unpacked, copied and otherwise configured automatically.

3. Final Touches

You now have just one file to edit: in the home directory of the user for whom you’ve just configured all this stuff, there will be a hidden file (so switch on hidden file viewing in Nautilus if you want to browse to it) called .conkyForecast.config. You need to edit that file, so in my case I’d issue the command (as myself, not root):

gedit /home/hjr/.conkyForecast.config

The last line of this file is a long-winded URL. In that URL, you’ll see the place-holders <LOCATION>, <XOAP_PARTNER> and <XOAP_LICENCE_KEY>.

Your job is to replace the LOCATION place-holder with the location code you discovered earlier -in my case, ASXX0022 for Campbelltown. Then replace the XOAP_PARTNER place-holder with the username you used to subscribe to the Weather Channel API. Finally, replace XOAP_LICENCE_KEY with the magic key you were sent in the second email from the Weather Channel.

As you do these replacements, make sure you don’t introduce any extra spaces or line breaks.

For those of you still stuck in pre-history and using Fahrenheit as your temperature measure (I don’t know why we don’t all just switch to Kelvin and have done with it!), change the very last bit of the URL from unit=m to unit=i (the ‘i’ means ‘imperial’ and thus Fahrenheit; the ‘m’ means ‘metric’, or Celsius)

4. All done

At this point, you can (as yourself, not as root) type the command conky to see what happens. If you’ve done everything right, you should see this sort of thing appear in the top right-hand corner of your desktop:

(And can’t you just tell we’re having a wonderful Summer here in Campbelltown!)

You now just need to make sure the ‘widget’ appears each time you log on: that’s a simple matter of clicking Startup Applications -> Add. In the dialog that appears, the Name can be something like Conky HTC and for the command, click [Browse], switch on hidden files in Nautilus once more and then select /home/<whoever>/.conky_start.sh.

Hopefully, that’s enough desktop bling to be going on with for now!

5. Acknowledgements

If I hadn’t read Altis at Crackerspot, I wouldn’t have known how to do this. Similarly, FergyTech‘s explanation of configuring conkyForecast was useful: not all the instructions contained there are relevant for this particular exercise, but the bit about where to store the files was key.

So, if you don’t like what my shell script does (it really is intended to be run right after a Portland clean install and doesn’t mind too much what it over-writes!), use their articles to do the job by hand. It’s not difficult, but you’ll never get that hour (or two!) back again!