This wiki will shut down!

Please note that this wiki will be made read-only and eventually be taken offline.

A replacement is being discussed at We'd be happy to have more input for that discussion and volunteers who help us migrate the content of this wiki to its replacement.


From awesome
Jump to: navigation, search

Awesome 2[edit]

w3m and bash[edit]

You'll need: w3m, a tb_weather textbox and an internet-connection...


if [ $# -ne 1 ]; then
        echo Usage: $(basename $0) city
        exit 1

w3m -dump "${CITY}+weather" > $FILE
FIRST=$(grep -n iGoogle $FILE | awk -F ":" {'print $1'})

sed -n -i "$FIRST,$LAST p" $FILE
TEMP=$(sed -n "1 p" $FILE)
WIND=$(sed -n "2 p" $FILE)
HUM=$(sed -n "3 p" $FILE)
SUN=$(sed -n "5 p" $FILE)
MIN_MAX=$(sed -n "6 p" $FILE | awk {'print $4$5" - "$1$2'})
MIN_MAX_TOMORROW=$(sed -n "9 p" $FILE | awk {'print $4$5" - "$1$2'})
SUN_TOMORROW=$(sed -n "8 p" $FILE)

echo 0 widget_tell tb_weather $SUN, $TEMP"("$MIN_MAX")  - " $WIND --- Tomorrow: $SUN_TOMORROW, $MIN_MAX_TOMORROW | awesome-client

rm ${FILE}

This is a "skeleton", you can modify this script.


bash script with wget for awesome 2.3[edit]

Here's another example:

# this script is for awesome 2.3

# station list at:

while true; do
  if [ -S ~/.awesome_ctl.0 ]; then
    while true; do
      NEW=$(wget -qO- "${LOCATION}.xml"\
        | sed -nr '/<(weather|temp_f)>/s/.*>(.*)<.*/\1/p' 2>/dev/null)
      if [ "x$NEW" != x ]; then
        NEW=$(echo "$NEW" | awk 'BEGIN{RS="";FS="\n"}{printf "%s %s\xb0",$1,$2}')
        echo -e "0 widget_tell mystatusbar weather text $NEW"
        echo "" # an empty line flushes data inside awesome
      sleep 600
    done | awesome-client
    sleep 1

--Profjim 16:19, 1 July 2008 (UTC)


This is a Perl example for XML weather from, you can change it.

use XML::Simple;
use LWP::Simple;
use strict;
use warnings;
my $wea=XMLin(get('*&unit=m'));
my $tmp=$wea->{'cc'}->{'tmp'};
my $t=$wea->{'cc'}->{'t'};
$t=~s/Light Rain Shower/LRS/;
$t=~s/Light Rain/LR/;
$t=~s/Light Snow Shower/LSS/;
$t=~s/Light Snow/LS/;
$t=~s/Light Freezing Rain/LFR/;
if (length($t)<=4) { $t=~s/ //g;}
my $bar=$wea->{'cc'}->{'bar'}->{'r'};
$bar*=0.75006; //converts to mmHg
my $wind=$wea->{'cc'}->{'wind'}->{'s'};
$wind/=3.6;    //converts to m/s and rounds it to nearest integer.
my $dir=$wea->{'cc'}->{'wind'}->{'t'};
print $tmp . "°C, " . $bar . " mmHg, " . $wind . " m/s, " . $dir . ", " . $t . "\n";

--IoGA 15:22, 17 November 2008 (UTC)

Awesome 3[edit]

Yahoo Weather[edit]

Widget set, naughty notification, nice icon updating at forecast change and day/night cycle, localization support.


--Luke Bonham 10:47:00, 29 October 2013 (CEST)

Google API + awful[edit]

I wrote a solution that makes a simple HTTP request to Google's Weather API based on postal code. See

--Jesseadams 06:15:38, 06 June 2011 (UTC)

Google API + libxslt + Naughty[edit]

Another solution, which shows Naughty notifications on mouse_hover at your widget (I use it for my text clock). Data is taken from Google API using query string, such as town name, postal code, etc. Futher reading at github

--IoGA 11:02, 7 August 2011 (CEST)

weather-util, awk, naughty and awful[edit]

This widget uses Naughty, awful, awk, the internet, and the commandline program "weather-util", which is also in the Debian, Ubuntu and Archlinux repositories. The widget creates a simple text box with the temperature, which you can hover over to get the full weather information.

Replace METARID with the metar ID of the weather station for your area. this is a four letter code like LYBE for Belgrade, Serbia. Stations list at [1]

--Create a weather widget

 weatherwidget = widget({ type = "textbox" })
weatherwidget.text = awful.util.pread(
  "weather -i METARID --headers=Temperature --quiet -m | awk '{print $2, $3}'"
) -- replace METARID with the metar ID for your area. This uses metric. If you prefer Fahrenheit remove the "-m" in "--quiet -m".
weathertimer = timer(
  { timeout = 900 } -- Update every 15 minutes. 
  "timeout", function() 
     weatherwidget.text = awful.util.pread(
     "weather -i METARID --headers=Temperature --quiet -m | awk '{print $2, $3}' &"
   ) --replace METARID and remove -m if you want Fahrenheit

weathertimer:start() -- Start the timer
"mouse::enter", function() 
  weather = naughty.notify(
    {title="Weather",text=awful.util.pread("weather -i METARID -m")})
  end) -- this creates the hover feature. replace METARID and remove -m if you want Fahrenheit
  "mouse::leave", function() 
-- I added some spacing because on my computer it is right next to my clock.
awful.widget.layout.margins[weatherwidget] = { right = 5 } 

Now add the widget in with your other widgets, for example left of the text clock:

mywibox[s].widgets = {

--Pthalo 22:35, 12 April 2011 (UTC)

Awesome 3.5[edit]

Based on the above code using weather-util, but updated for Awesome 3.5 and using a simple ZIP code search instead of METARID.

--Create a weather widget
weatherwidget = wibox.widget.textbox()
   "weather ZIP --headers=Temperature --quiet | awk '{print $2, $3}'"
)) -- replace ZIP with the ID for your area. If you prefer Metric add "-m".
weathertimer = timer(
   { timeout = 900 } -- Update every 15 minutes.
   "timeout", function()
         "weather ZIP --headers=Temperature --quiet | awk '{print $2, $3}' &"

weathertimer:start() -- Start the timer
   "mouse::enter", function()
      weather = naughty.notify(
         {title="Weather",text=awful.util.pread("weather ZIP")})
end) -- this creates the hover feature.

   "mouse::leave", function()