lcpz / lain

Awesome WM complements
GNU General Public License v2.0
1.06k stars 210 forks source link

mousing over weather widget does not bring up forecast notification #113

Closed gajjanag closed 9 years ago

gajjanag commented 9 years ago

The old yawn widget would display detailed weather stats when moused over in its default configuration, while the new weather widget does not.

aajjbb commented 9 years ago

I'm about to start an 'add-on' to fix this, copycat-killed mentioned before that this new widget gives more 'control' to the user. It probably mean now we have to decide by ourselves what will be presented on 'w_notification_preset' which is an empty table by default.

It would be nice if everyone who already wrote content for this table share the code with us.

gajjanag commented 9 years ago

I don't fully understand - one can still popup the extended forecast via a keybinding, e.g via: awful.key({ altkey,}, "w",function() myweather.show(5) end),

So clearly this extended forecast info can be brought up easily. Why can't mousing over the widget bring up the same stuff, as it once did before? Of course, customization of this should be user defined.

aajjbb commented 9 years ago

Oh, I'm sorry. I didn't realized it's already implemented in this new widget, but now, you have to 'attach' this notification in your widget.

Add this line in your rc.lua after create your weather widget:

weather = lain.widgets.weather({
      city_id = xxxx,
      settings = function()
         if weather_now then
            units = math.floor(weather_now["main"]["temp"])
            widget:set_markup(markup("#eca4c4", " " .. units .. "°C "))
         end
      end
})
weather.attach(weather) 
lcpz commented 9 years ago

I thought to let the user decide whether he wanted the two things together or not.

But since already two of you use to hover over the widget, I'll add this as default again.

lcpz commented 9 years ago

@aajjbb On the control part: not only you can now set w_notification_preset as you wish, but you can feed your widget with whatever is fetched from the API call, as requested here.

Of course, this may require you a little searching in the weather_now table, but nothing difficult. I hope the wiki is clear and thorough, plus it has a couple of examples. But if you still need a hand in your customization, I'm here to help.

PS: weather_now should never be nil within settings.

aajjbb commented 9 years ago

Hi, I think w_notification_present information is complete for me, the unique thing I'd like to increment is make it recognize my current location city_id as it can be handy for ones who travel frequently.

I'll try to work on this in the next weeks, if I come up with something good I'm going to pull request.

PS: I've had some naughty notifications about weather_now being nil, so it's why I added this if.

lcpz commented 9 years ago

I'll check OpenWeatherMap or contact them to see if it's possible to reproduce via API the same geolocalization that happens via browser.

PS: I've had some naughty notifications about weather_now being nil, so it's why I added this if.

Try the latest commit without the if, and check if the issue is still present.