Pages

2014-01-07

Second Conky for weather

I went even further with my blingish adventures... Somewhere - related to tweaking conky - I stumbled upon weather forecasts. The thing never interested me much - as I don't consider weather-forecast overly trustworthy activity, and also, I didn't feel need to complicate my Linux-wrestling with trifle things.
Well, it suddenly felt alright now.
Here it comes - very simple conky with very simple layout, and launched from Openbox root-menu.

Essential link. The same info can be found in Cruchbang forum. From here (or there) you can get scripts for automatic download of data and conkyrc-s for presenting it.
I didn't change the script (except the URL of weather-data page), but I changed conkyrc quite heavily. I didn't want pics and special fonts and stuff - I wanted it to be functional, period.

Currently it looks like that, but will be tuned a bit more. Screws are for fitting in with my slightly-steam-punkish theme.

No code comes here for conkyrc, but two very helpful links:

Essentially: go get script and conkyrc. Tune conkyrc. Almost done.
Almost, because maybe of interest is:

- getting weather-conky working and quitting according to need. I, for example, do not want it sillily hanging on desktop - temperatures doesn't change so fast that it should require permanent watch. 
And here comes code for that. Which is borrowed in very big extent from Ubuntu forum.
/bin/wconky.sh - checks for weatherconkys' pidfile existence in folder where it's created. If it's already there, kills conky, if it's not there, starts conky and writes new pidfile.


#!/bin/bash
# ----------
# Simple script to start/kill weather conky

# folder where script is and data will be
basedir="/home/user/accuweather_conky/"
# pidfile name
pidfile="$basedir/weatherconky.pid"
if [ ! -e "$pidfile" ]
   then
   PROG="conky -c /home/user/.conkyrc_acc_int"
   $PROG &
   PID=$!
   echo $PID > "$pidfile"
else
   pidkill=`cat $pidfile`
   echo $pidkill
   kill -9 $pidkill
   rm $pidfile
fi

exit 0

Why this pidfile stuff? Beacuse I already have one conky started from autostart, with nice minimal sys-info, and I don't want that one killed (with killall). And naturally I am too lazy for pgrep and manual kill -9.

I stuck the script into main OB menu, just before 'exit'. No mysteries here: simple 'sh wconky.sh' as the execute command.
And that's it. Click once - get weather, click second time - no weather.
It was mildly interesting thing to fiddle with. It's usefulness is still in doubt.

No comments: