By Ben Nitkin on
XFCE (the desktop environment I use) has many neat plugins. Among them, I use a mail plugin that checks all my accounts, a mixer, and a weather plugin to grab a forecast. I'm fond of having a radar display to see what's coming my way, but XFCE doesn't have a radar gadget. So I made one.
Weather.gov (URL case doesn't matter. Deal with it.) provides radar images for the entire country. The images are split into layered GIF files - one file provides city names, another draws counties, a third has the key, and so on. I downloaded the topographical map and the county lines, and merged them using imagemagick (a very powerful command line image manipulator).
Next, I wrote a (very, very simple) script to grab the current radar image, merge it and the background I created into a new file, and then display the composite. The first few lines specify variables: the radar image to grab, and the working directory. Next, the program downloads the radar image, merges it and the background to create output.gif, then displays output.gif using libnotify.
#!/bin/bash
DIR="/home/ben/.config/radar"
URL="http://radar.weather.gov/RadarImg/N0R/DIX_N0R_0.gif"
cd $DIR
curl $URL > radar.gif
convert back.gif radar.gif -composite output.gif
notify-send -i $DIR/output.gif Radar
My last step was to add a button to the panel to trigger the script. Now I can see the local radar at the push of a button!
Computers are really, really cool.
There's one problem: libnotify shrinks the image down to a 50x50px thumbnail. It's big enough to see rough weather patterns, but I'd prefer a larger radar image. I might just write something in Python to emulate libnotify.