I'm using the vicious weather widget with a naughty notification with some 
additional weather info when I hover over it. It uses the following code:

weatherwidget = widget({ type = "textbox" })
vicious.register(weatherwidget, vicious.widgets.weather,
 function (widget, args)
  if args["{tempc}"] == "N/A" then
   return ""
  else
   weatherwidget:add_signal('mouse::enter', function () weather_n = { 
naughty.notify({ title = "Weather", text = "Wind    : " .. args["{windkmh}"] .. 
" km/h " .. args["{wind}"] .. "\nHumidity: " .. args["{humid}"] .. " 
%\nPressure: " .. %args["{press}"] .. " %hPa", %border_color = %"#1a1918", 
timeout = 0, %hover_timeout = 0.5 }) } end)
   weatherwidget:add_signal('mouse::leave', function () 
naughty.destroy(weather_n[1]) end)
   return "weather: " .. string.lower(args["{sky}"]) .. ", " .. args["{tempc}"] 
.. "°C"
  end
 end, 1200, "YBTL" )

At the beginning (ie. after an awesome restart) it works as expected. The 
problem is that the notification gets multiplied (ie. I get one notification 
window, then two, then three, etc., when I hover over it with my mouse) 
whenever the widget gets updated (ie. after 1200 seconds). Also, the 
"mouse::leave" function works at the beginning, but after the first update, 
when I get two notification windows, they keep hovering around for a while, 
even though I moved my mouse away.
Now, I've tried a range of different rewrites to stop this from happening -- 
from putting the "weatherwidget:add_signal" at the end to fiddeling around with 
"functions" and "local" variables. It either results in it not working at all 
or it showing the same problem.
I'm kind of at the end of my wisdom. Does anyone have a clue what I'm doing 
wrong? Any hints would be much appreciated. Thanks.

-- 
To unsubscribe, send mail to [email protected].

Reply via email to