TkWeather, by Jim Turner c. 2003 - 2016
tkweather.pl [zip-code|locate [site]] tkweather.pl --help (display usage message)
This program displays a nice square iconic button showing the current weather condition. Clicking the button shows the current basic weather condition values, such as temperature, humidity, and wind. Clicking again shows additional information, namely the barometric pressure, UV, visiblility, and "heat index" or "wind chill" or "misery index". For anyone not from Houston, Texas, the "misery index" is the temperature plus dewpoint. Anything over 150 is considered "miserable"! I use this for planning workouts. The default is to use the more modern "heat index". Specify "index=misery" for the old Houston "misery index". "wind chill" is used if the temperature is below 70 and wind is >= 10mph regardless.
"site", is currently 0: "weather" (weather.com), 1: "wunderground"(www.wunderground.com), 2: "noaa" (www.noaa.gov). If it fails on the selected one, it tries the next one. The default is 0: "weather". This program fetches the current conditions every 15 minutes (900 seconds) from www.weather.com, www.wunderground.com, www.noaa.gov, or weatherbug based on your configuration choce.
How to set up:
1) Windows users: If installing on Windows, simply run the self-extracting exe, which will install everything automatically and only do step 4 below. If the program crashes, try running the tkweather_nogui.exe version and examine the output. For Linux / source users: 2) Create a "tkweather" directory in your home directory.
3) You will also need to specify your zipcode either as the command-line argument or add a "zipcode=yourzip" line in $HOME/tkweather/tkweather.cfg Otherwise you get the zip-code returned by geolocatezip.pl!
4) The optional file: $HOME/tkweather/tkweather.cfg takes the format (defaults shown below): Any line starting with "#" is ignored as a comment.
geometry=+100+100 #ZIPCODE CAN BE SET TO A SPECIFIC ZIPCODE OR "locate" MEANING DETERMINE FROM ISP'S LOCATION. zipcode=5-digits || locate #BROWSER TO BE INVOKED IF USER PRESSES SHIFT-CLICK ON BUTTON. browser=mozilla #URL USED FOR SCRAPING WEATHER DATA. weatherurl=http://www.w3.weather.com/weather/local/<ZIP>?lswe=<ZIP>&lwsa=WeatherLocalUndeclared #COMMAND URL TO BE INVOKED IF USER PRESSES SHIFT-CLICK ON BUTTON. weathercmd=http://www.wunderground.com/cgi-bin/findweather/getForecast?query=<ZIP> & #MILLISECONDS TO WAIT BETWEEN QUERIES TO THE WEATHER URL. checkmsec=900000 #BUTTON RELIEF (CHOICES: flat, groove, raised, ridge, sunken) relief=ridge #INDEX: "heat" or "misery": USE MODERN "HEAT INDEX" AS REPORTED, #or use old "MISERY INDEX" (HEAT+DUEPOINT). #NOTE: WIND CHILL IS REPORTED IF TEMP. < 70 AND WIND >= 10 MPH REGARDLESS OF THIS SETTING! index=heat #OVERRIDEDIRECT ARGUMENT 0=MANAGED BY WINDOWMANAGER (DECORATE) #1=BYPASS WINDOWMANAGER (NO DECORATION). USE 0 IF DOCKING IN #WINDOWMAKER OR AFTERSTEP. windowmgr=0 #STARTUP ICON IMAGE (MUST BE IN $ENV{HOME}/tkweather/) startimage=tkweather.gif #NORMAL TEXT FOREGROUND COLOR normalcolor=green #WARNING COLOR warningcolor=yellow #ALERT COLOR alertcolor=red #NORMAL BACKGROUND COLOR bgcolor=black #SHOW WARNING/ALERT COLOR IN BACKGROUND OF ICON (0=OLD WAY - BGCOLOR) bgwarn=1 #CONVERT TEMPS AND WINDSPEED TO METRIC, IF SET. metric=0 #DO NOT DISPLAY MESSAGE TO STDERR WHEN FETCHING WEATHER FROM WEB (if set to 1): silent=0 #DO NOT DUMP DEBUG INFORMATION TO STDERR debug=0
5) Copy the image "tkweather.gif" to $HOME/tkweather/
6) Copy tkweather.pl and geolocatezip.pl to somewhere in your PATH or wherever you want to be able to run it from. Make sure line 1 points to your perl interpreter.
7) To make this app appear in your AfterStep/Windowmaker "wharf", add the following to your config file: *Wharf Tkweather - MaxSwallow "Tkweather" tkweather.pl & 8) Enjoy!