Xfce Forum

Sub domains
 

You are not logged in.

#1 2011-11-16 05:48:04

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Weather applet

The weather panel applet is broken. I understand it has been broken since about the first of the month because it was coded to get data from weather.com, which cut us off when they started requiring a paid subscription. Is there any hope for this applet? Is there another (free) feed that it can be set to? Or is there a way to use the Gnome panel weather applet (which still works)?


Linguistics on Linux!

Offline

#2 2011-11-16 06:55:22

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Weather applet

This site shows the Gnome weather applet running in an Xfce panel using xfapplet.

http://goodies.xfce.org/projects/panel- … let-plugin

Supposedly xfapplet allows you to run almost all Gnome panel applets that are installed.

I added the xfapplet to my Xfce panel, but the list of available Gnome applets is very short and does not list the Gnome weather applet. Yet I have Gnome installed as well as Xfce4 on this computer (Fedora 14, x86_64), and I have the Gnome weather applet in my Gnome panel. Therefore, it must be installed. Unfortunately, Thunar can't find it, Yum Extender can't find it, and I can't find it.

When I am in Gnome I have tons of applets available to add to the Gnome panel, where xfapplet shows only half a dozen. There must be a way to tell xfapplet where my Gnome panel applets are located, but I can't find any documentation that tells me how.

Any suggestions?


Linguistics on Linux!

Offline

#3 2011-11-17 20:11:02

paolo321
Member
Registered: 2011-06-26
Posts: 121

Re: Weather applet

Don't remember the details, but some time ago I read that xfapplet did not support "newer" applets ... at that time, newer was gnome 2.3.x
Today with gnome 3 I think that xfapplet will not have much future, at least imho

If you use xubuntu, try indicator-weather (it uses indicator plugin for xfce panel, don't know if it's supported outside xubuntu, sadly...)

Offline

#4 2011-11-20 02:14:28

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Weather applet

paolo321 wrote:

Don't remember the details, but some time ago I read that xfapplet did not support "newer" applets ... at that time, newer was gnome 2.3.x
Today with gnome 3 I think that xfapplet will not have much future, at least imho

If you use xubuntu, try indicator-weather (it uses indicator plugin for xfce panel, don't know if it's supported outside xubuntu, sadly...)

No xubuntu here; I'm using Fedora 16, x86_64. I found the web page for indicator applet. Apparently I could download the source and compile it, if I knew how. sad

As for newer/older, I used the Gnome weather applet for many years, and it's still there if I log in to Gnome 2.3.2 on my Lucid desktop computer. I haven't actually ever logged into Gnome 3 since upgrading to Fedora 16. I tried the live CD and that was enough.

More important, there has been a discussion lately of the Xfce weather applet on the Debian listserv. (Xfce seems to be popular among Debianites.) Apparently there is a new version of the Xfce weather applet that works and is currently available in the Debian Testing repos.


Linguistics on Linux!

Offline

#5 2011-11-20 11:47:14

Nice&Gently
Member
From: Berlin, old europe
Registered: 2011-05-22
Posts: 26

Re: Weather applet

The patch is already in the git version.
http://git.xfce.org/panel-plugins/xfce4-weather-plugin/ , Commit message Start parsing yr.no xml .
I've tested it under fedora 16 and it works again. :-)

Edit: The weather forecast doesn 't work yet with this development version

Last edited by Nice&Gently (2011-11-20 13:56:00)


Life's too short for boring desktops

Offline

#6 2011-11-22 04:54:21

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Weather applet

I see the file, but I'd still have to compile it.

In several years of running Linux I have tried to compile programs maybe a dozen times. I have yet to get one to work. I'll wait until there is a package.


Linguistics on Linux!

Offline

#7 2012-01-21 22:17:34

RobbH
Member
Registered: 2012-01-21
Posts: 4

Re: Weather applet

I have a working alternative (in my opinion, anyway) using the panel generic monitor plugin. As written, It only works in the USA, as it uses our National Weather Service mobile pages as its data source. Using it requires editing a Bash script and manually configuring the plugin. If anyone is interested, I'd be happy to post the code here, assuming that's permissible by forum rules. (Moderators, any comment?)

As I've configured it, this plugin puts the current temperature on the panel, and beside it an icon of your choice to indicate the absence or presence of severe weather alerts. The tooltip shows current conditions and the time of the observation. Clicking on the temperature or icon can be configured to open your favorite local weather page in the browser of your choice.

Additional disclaimer: I can't be certain that all NWS forecast offices use the same formatting that I've designed this to work with. So it may not even work for all locations in the USA! One way to find out...

Offline

#8 2012-01-23 19:36:49

Slighooker
Member
Registered: 2012-01-23
Posts: 9

Re: Weather applet

I'd be interested in your script

Offline

#9 2012-01-24 05:57:02

RobbH
Member
Registered: 2012-01-21
Posts: 4

Re: Weather applet

Slighooker wrote:

I'd be interested in your script

Thanks for your interest! I hope you aren't disappointed. smile

As stated in my previous message, this is only for those who live in the USA (or want to monitor weather at a location in the USA), because it uses the US National Weather Service mobile weather pages as its data source. Maybe someone can modify it to work with services that are available in other countries.

First of all go to the mobile weather home page, which seem to follow a uniform format across the country (but of course I can't be certain of that):

http://mobile.srh.weather.gov/

Enter the location you want. When you arrive at that locality's home page, you will find links to six other pages. You need to get the URLs for two of those links. The "Current Conditions" URL will be referred to as [CURURL] below and the "Hazardous Weather" will be [WARNURL].

You will also need some icons. I have Gnome installed on the machine where I'm now using XFCE, and I found some usable icons under /usr/share/icons/gnome/. I chose the 22x22 icons. If you wish to use the same icons (or at least, icons with the same names), packages of Gnome icons seem to be freely available at http://art.gnome.org/themes/icon and individual icons are on Wikimedia Commons at http://commons.wikimedia.org/wiki/Categ … ktop_icons in svg format. The weather icons I used are in the "status" folder, except the "generic emblem" icon (used as a fallback if we can't find a match with conditions), which is in the "emblems" folder.

Of course, you can use any icons you want, but you will have to edit the icon section of the script to use different file names. If you use the Gnome icons with the same names, all you need to do is replace [ICONPATH] with the correct value.

Or you can use no icons, if all you want is the current temperature on the panel and a tooltip with the current sky condition; without an icon of some sort, you will lose the ability to click on the icon and start your browser.

The script will create the file "curwxcdn.xml" in your home directory. That's the file the genmon plugin uses.

The genmon plugin does NOT run this script. You'll need to take of that yourself. I have cron configured to run it on system startup, and a few minutes after the top of every hour. The NWS does not update its mobile "current conditions" pages more than once an hour, so please do not set it up to run more often than that. The Hazardous Weather pages may be updated more often, so I'm considering a version that checks hazards more frequently, but only downloads conditions once an hour. Until that's done, this is what's available.

With those preliminaries out of the way, here's the script. It's untested, except by me, and it's not pretty. I'm sure much of it could be written better, and I hope that anyone who improves on it will post their version:

#!/bin/bash

#Get local weather conditions and warnings for locations in the USA
#For use with XFCE Panel Generic Monitor (xfce4-genmon-plugin 3.3.0)
#Uses National Weather Service mobile pages as data source, formatting as of January 23, 2012
#This script should be run a few minutes after every hour; it generates the xml file used by the genmon plugin

# Fetch current conditions
CWCDN=`wget -q -O - "[CURURL]"`
# Fetch current watch/warning status
CWARN=`wget -q -O - "[WARNURL]"`

#extract warnings
#...           find warning line(s)...  break into multilines... extract elements... remove Outlooks...remove remaining tag
CURWARN=$(echo "$CWARN" | grep 'class="warn"' | tr '>' '\n' | grep '</span' | grep -v 'Outlook' | cut -d '<' -f1)

#extract temperature
#...                  find temperature line.. change & to space.. keep 2nd field.. strip newline
CURTEMP=$(echo "$CWCDN" | grep 'Temperature:' | tr '&' ' ' | awk '{print $2}' | tr -d '\n')
#extract sky condition
#...                  find Current Weather line.. change < to space.. keep 2nd field.. strip newline
CURCOND=$(echo "$CWCDN" | grep 'Weather:' | tr '<' ' ' | awk '{print $2}' | tr -d '\n')
#extract update time/date
#...                  find Last Update line.. discard last field.. keep 3rd field to end fo line
CURTIME=$(echo "$CWCDN" | grep 'Update:' | awk '{$NF=""}1' | cut -f3- -d ' ')

# Create xml file
echo "<txt>$CURTEMP</txt>" > ~/curwxcdn.xml
env echo -ne "<tool>" >> ~/curwxcdn.xml
# Begin tooltip with warning, if appropriate
if [ "${#CURWARN}" -gt "2" ]
then echo $CURWARN >> ~/curwxcdn.xml
fi
# continue tooltip with conditions, temperature, ovservation time, and location
echo "$CURCOND: $CURTEMP"  >> ~/curwxcdn.xml
echo "$CURTIME" >> ~/curwxcdn.xml
echo "[MY LOCATION]</tool>" >> ~/curwxcdn.xml

# Change icon depending on conditions or warning status
# search for condition matches without regard to case
shopt -s nocasematch
if [ "${#CURWARN}" -gt "2" ]
then WXICON="[ICONPATH]/weather-severe-alert.png"
else
case "$CURCOND" in
	*snow*) WXICON="[ICONPATH]/weather-snow.png" ;;
	*ice*) WXICON="[ICONPATH]/weather-snow.png" ;;
	*sleet*) WXICON="[ICONPATH]/weather-snow.png" ;;
	*freez*) WXICON="[ICONPATH]/weather-snow.png" ;;
	*drizzle*) WXICON="[ICONPATH]/weather-showers-scattered.png" ;;
	*'light rain'*) WXICON="[ICONPATH]/weather-showers-scattered.png" ;;
	*rain*) WXICON="[ICONPATH]/weather-showers.png" ;;
	*shower*) WXICON="[ICONPATH]/weather-showers.png" ;;
	*storm*) WXICON="[ICONPATH]/weather-storm.png" ;;
	*thunder*) WXICON="[ICONPATH]/weather-storm.png" ;;
	*lightning*) WXICON="[ICONPATH]/weather-storm.png" ;;
	*hail*) WXICON="[ICONPATH]/weather-storm.png" ;;
	*fog*) WXICON="[ICONPATH]/weather-fog.png" ;;
	*mist*) WXICON="[ICONPATH]/weather-fog.png" ;;
	*overcast*) WXICON="[ICONPATH]/weather-overcast.png" ;;
	*'mostly cloudy'*) WXICON="[ICONPATH]/weather-overcast.png" ;;
	*cloud*) WXICON="[ICONPATH]/weather-few-clouds.png" ;;
	*clear*) WXICON="[ICONPATH]/weather-clear.png" ;;
	*sun*) WXICON="[ICONPATH]/weather-clear.png" ;;
	*) WXICON="[ICONPATH]/emblem-generic.png" ;;
esac
fi
echo "<img>$WXICON</img>" >> ~/curwxcdn.xml

# On click, start dillo with local NWS page
echo "<click>" 'dillo "http://forecast.weather.gov/[MY LOCAL WEATHER PAGE]"' "</click>" >> ~/curwxcdn.xml

# End of script

I have the genmon plugin configured to run "cat curwxcdn.xml" every 60 seconds and capture the output. And I'm using "Sans 12" as the font. No label.

Good luck!

Offline

#10 2012-01-25 04:28:00

Slighooker
Member
Registered: 2012-01-23
Posts: 9

Re: Weather applet

Thanks, I'll give it a go in a bit. I just learned how to change the font color for Xfce's weather applet so I am not in a hurry but I would like to give it a try.

Offline

#11 2012-01-26 03:04:55

RobbH
Member
Registered: 2012-01-21
Posts: 4

Re: Weather applet

Slighooker wrote:

Thanks, I'll give it a go in a bit. I just learned how to change the font color for Xfce's weather applet so I am not in a hurry but I would like to give it a try.

So the panel weather applet is working for you? That's good news!

Offline

#12 2012-01-26 03:26:56

Slighooker
Member
Registered: 2012-01-23
Posts: 9

Re: Weather applet

Yeah, the fix showed up in the beginning of December or there abouts in Debian Wheezy.

My problem was that I use a light theme with my desktop being an image that is very dark. I like transparent panels, so the black text of the weather applet was hard to read. Especially hard when I glance at my screen as I am about to leave to see what I should wear for the bike ride. I had to create another panel and give it a light background so I could see the temp. I didn't like that. I also ran desklets, but I thought that was a waste for one item. After much searching, I finally found a way to get the text to show up in a color of my choice. Much better now and no more desklets.

Offline

#13 2012-01-26 21:33:02

easilok
Member
Registered: 2011-11-01
Posts: 2

Re: Weather applet

Hi Slighooker,

Can you tell how you do to select the text color of the applet text?

Offline

#14 2012-01-26 22:26:47

Slighooker
Member
Registered: 2012-01-23
Posts: 9

Re: Weather applet

Sure. First I saw the tip about the gtkrc files at http://wiki.xfce.org/tips. I added these to my ~/.gtkrc-2.0 file. There was nothing about the text, so I added it. This worked, but I didn't want it in that file in case I wanted to use a different theme in the future that wouldn't work well with those additions. So, I copied the themes I wanted to my ~/.themes directory and modified the gtkrc files for each theme. I then commented the lines in the .gtkrc-2.0 file. This also worked.

My ~/.themes/[theme name]/gtkrc file:

style "panel-color" {  
  fg[ACTIVE]               = "#111111"
  bg[NORMAL]               = "#edeff2"
  bg[PRELIGHT]             = "#213d60"
  bg[ACTIVE]               = "#042230"
  font_name = "bold"
  text[NORMAL]      = "#cccc33" # color for the text in the weather applet
}

widget "*PanelWidget*" style "panel-color"
widget "*PanelApplet*" style "panel-color"
widget "*Panel*" style "panel-color"          # Changes the selected Background around the trash applet
widget_class "*Panel*" style "panel-color"  # Used to change the weather applet in Xfce text color also background in the panel selected, active, etc. buttons
#class "*Panel*" style "panel-color"
#class "*Tray*" style "panel-color"
#class "*tray*" style "panel-color"

I then commented the parts that didn't seem to do anything for my setup and changed somethings for my liking. I also put the comments in for me to understand later. There is one problem with this. The way I have it, the text color for the weather applet is also the text color when you try to add a new items to the panel. If you pick white and the background of the new item selection window is white, you won't be able to read it. You can when you select an item though. I didn't like that, so I picked another color that I am happy with. In my case a bolded red. It's kind of strange in the new item window, but I rarely use that, so it is not important to me.

There might be a way to just use the .gtkrc file for just the weather applet, but I haven't dived into learning gtk enough to do that yet. But I think you can use regular expressions to distinguish different items, I might be wrong though. My comments in the code above should allow you to change the text color, if you have any questions, I'll try to help but I am not an expert at gtk in any form.

Oh, to see the changes, just switch themes, then back to the one you modified.

Offline

#15 2012-05-12 21:03:12

Digger
Member
Registered: 2012-01-18
Posts: 26
Website

Re: Weather applet

UPDATE:

The latest Debian Squeeze update (6.0.5) updates "xfce4-weather-plugin".  It now works on my panel with no fiddling around.

FYI.

Last edited by Digger (2012-05-12 21:09:19)


Xfce 4.6.2; Debian Squeeze

Offline

#16 2012-10-05 01:46:58

Happyozzie
Member
Registered: 2012-10-05
Posts: 2

Re: Weather applet

Hi
How do I install the weather applet please?
I have downloaded it from http://goodies.xfce.org/projects/panel- … her-plugin but I can't work out how to install it or where to?

thanks

Tracey

Offline

#17 2012-10-05 02:35:46

ozjd
Member
From: Hawkesbury NSW Australia
Registered: 2012-02-05
Posts: 560
Website

Re: Weather applet

Happyozzie wrote:

Hi
How do I install the weather applet please?
I have downloaded it from http://goodies.xfce.org/projects/panel- … her-plugin but I can't work out how to install it or where to?

thanks

Tracey

That's the source code you have. The easiest way is to see if you can install it from your distro's repos. You don't say which distro you are using.

Offline

#18 2013-01-22 00:32:11

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Weather applet

It has been a long time since I started this thread, and I'm happy to see that progress has been made.

Before I go further, my location is Portland, OR USA 97217.

My laptop still has Fedora 16 (will upgrade to 18 soon), but until the other day my desktop had Lucid x86_64. A power outage blew out my Bluetooth computer-sound-to-stereo device on that computer, plus I had been ignoring updates for ages, so I just wiped it out and installed Xubuntu 12.04 x86_64.

I never tried getting the weather app on my laptop, because I could always glance at the desktop with the Gnome weather app in its panel. But now that the desktop has Xfce I decided to try he weather app. It runs great. And then I installed it on my Fedora 16 laptop. Not quite so great. Plus there are differences that I can't figure out.

Fedora 16 laptop has xfce4-weather-plugin 0.8.2-1
Xubuntu 12.04 desktop has xfce4-weather plugin 0.7.4-3

Both installed from respective repositories.

Now, on both computers I have configured the panel on the left side of the screen, 100 pixels wide, 75 pixels tall, not locked. I realize this is not standard, but that's what I like because it maximizes my vertical space for text documents.. smile

On both computers, because the panel is so wide, the weather conditions icons are huge. I wish I could just delete them altogether. I do have a real window in the house made of genuine glass that I can look out of to tell if is sunny or cloudy or whatever. Mostly I just want the outside temperature, and occasionally I want to check the forecast.

On the Xubuntu computer the temperature displays correctly under the weather condition icon. On the Fedora laptop the temperature displays rotated 90 degrees clockwise, because apparently the applet thinks it is in a horizontal panel. Note that the Xubuntu computer has the temperature display correct, yet it is the older of the two versions. In other words, I wish I could go back to the older version for the Fedora laptop.

As I write this the laptop says the outside temperature is 5.2 C, and the Xubuntu desktop says the temperature is 4 C. The Fedora laptop says it last checked the temperature at 5:00 pm, although at the moment it is 4:13. Amazing plugin - it can even foretell the temperature at future times. smile

Doubtless the temperature difference is because the Fedora laptop is set to The Norwegian Meteorological Institute, while on the Xubuntu computer the plugin is set to The Weather Channel (weather.com). Perhaps foretelling the future is a skill that only Norwegians have. smile  I also have an outdoor thermometer and it reads about 4 C, so the Norwegians may be able to foretell the future, but they're not doing so hot at reporting the present. smile

All things considered, I'd like to uninstall 0.8.2-1 from my laptop and install the older 0.7.4-3 because it's more accurate and the text displays properly. Unfortunately, I don't know an easy way to do this. In theory I could take the .deb package from Xubuntu, convert it to .rpm with Alien, and then install it on the laptop. Is there an easier or more reliable way? Or does anyone have alternative ideas or suggestions?


Linguistics on Linux!

Offline

#19 2013-01-22 00:39:24

ozjd
Member
From: Hawkesbury NSW Australia
Registered: 2012-02-05
Posts: 560
Website

Re: Weather applet

Offline

#20 2013-01-22 04:37:51

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Weather applet

Thanks! Got it!

I started by trying to erase 8.4.2-1 using Yumex. Right-clicking on it gave me the option to reinstall, but not to remove. Odd. And there was also an option to downgrade to 7.4.2, but I was unable to select the downgrade option. Very strange. So finally I erased 8.4.2-1 using the command line, then installed 0.7.4-2 from the command line. All went without error.

But when I try to add it to the panel it does not appear in Add New Items. I wonder what the trigger is to get the panel to realize it is available.


Linguistics on Linux!

Offline

#21 2013-01-28 22:22:01

malagant
Member
From: St. Louis, MO
Registered: 2006-08-03
Posts: 2
Website

Re: Weather applet

I'm running 4.10 and the Norway weather service.
Unfortunately the weather is at least 15 degrees F off today.
It averages anywhere from 5 to 15 degrees wrong depending on the day.

Is there a way to change to the NWS or something?

Thanks!

Offline

Board footer

Powered by FluxBB