Languages

User login

Installing conky with weather forecast in Ubuntu 10.10

November 29, 2010
by wgarcia

(UPDATE on November 26, 2011: the weather.com site has changed and I have updated my scripts so that they still work)

Conky is a free, light-weight system monitor for X, that displays any information on your desktop. Yesterday, after a question I got in an Ubuntu forum, I decided to install it in my Ubuntu 10.10 desktop and laptop computer. It was not easy and I had to go to different forums posts and links, so I decided to write this post on what I did.

My conky setup involves two different sections and occupies quite a bit of the desktop. In the the two monitor setup of my desktop this is not a problem, but in the laptop it has the problem that Conky, despite sitting always below any windows, sits over desktop iconcs, so any icon that you have in the desktop area where conky sits will be hidden by it. I don't use desktop icons too much and the icons can still be accessed by hovering over the conky window with the mouse, but be aware of this if you want to install it.

In my desktop computer I'm using two monitors and I have configured Conky to show in the upper right corner, and it shows in the second screen. In the laptop it's also defined to show up in the upper right corner. I also installed conkyForecast which is a python script to access weather information for conky fed from www.weather.com, an online weather service.

This is how nice it looks in the laptop, with the "comet" background that can be found in /usr/share/backgrounds/cosmos/comet.jpg:

The first thing to do is to install conky itself:

sudo apt-get install conky

We will wait to configure conky until we have installed everything for the weather forecast.

You need information on your location. For this browse to the www.weather.com site, and on the upper left part you will find a text field to enter a location and ask for the weather there. Enter your location, for instance I entered Barcelona, and look the URL of this in your browser, I for instance see:

http://www.weather.com/weather/today/Barcelona+Spain+SPXX0015

You need the code after the last "+" sign, that is SPXX0015.

Before going on you need to download a couple of fonts, at least for my setup, one for the Ubuntu logo and title, and the other one for the weather symbols (sun, clouds, and so on).

The ubuntu symbols can be downloaded from:

http://www.gnome-look.org/content/show.php/OpenLogos?content=54390

You can place the downloaded file either in a folder called ".fonts" in your home directory or in /usr/share/fonts/truetype/myfonts.

The weather font you can download from:

http://www.dafont.com/search.php?psize=m&q=weather

Install the ttf file (rename it to weather.ttf) in any of the two places above.

Next you have to install the conkyForecast python script. This is in a PPA, you can install it with the following two lines in a terminal:

Well, everything has been installed now. We now have to edit the configuration file for conky and for conkyforecast. We first have to edit the file ".conkyForecast.config" that we put the home directory:

Next you have to create two files in your home directory, ".conkyrc1" and ".conkyrc2" to configure each one of the conky panels that can be seen in my desktop. Here they are, take care of also entering your location in the appropriate places instead of mine. In ".conkyrc1" adjust also the parameters for processors and disk to your environment:

You can try the configuration to see if everything is OK by giving the following commands from a terminal:

conky -c ~/.conkyrc1 &

conky -C ~/.conkyrc2 &

Now finally you have to configure these two commands as startup programs so that you get conky in your desktop every time you start your desktop. For this you have to create another script to autostart conky when you start your desktop session. This is the script. that you have to locate in your home directory and call for instance .conky_autostart.sh:

And now you have to go to the menu Preferences -> Startup programs, and add this script as it is shown in the following screenshot:

A final comment on the problem that I mentioned at the beginning on hidden icons. If a desktop icon is placed in the area where you have the conky output, it will be hidden by it sitting between the desktop and conky and you will not be able to see it. This does not happen with desktop windows which always sit in front of conky. This is not a big problem for me since I keep my desktop quite clean of icons, but if I plug in a USB for instance, the shortcut may come in the conky area and be hidden. This is not a problem either, if you don't find an icon just hover with your mouse over the conky area and the pointer will change to a pointing finger when it is over the icon. Just press the left button of the mouse and keeping it pressed move to another area of the desktop free of conky. This will move the hidden icon out of the conky area.