lcpz / lain

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

Error in weather widget #479

Closed oxysoft closed 3 years ago

oxysoft commented 3 years ago

Stacktrace

stack traceback:
    /usr/share/awesome/lib/naughty/core.lua:436: in upvalue 'set_timeout'
    /usr/share/awesome/lib/naughty/core.lua:703: in function 'naughty.notify'
    /home/nuck/.config/awesome/lain/widget/weather.lua:66: in field '?'
    /usr/share/awesome/lib/wibox/widget/base.lua:482: in upvalue 'drill'
    /usr/share/awesome/lib/wibox/widget/base.lua:495: in upvalue 'drill'
    /usr/share/awesome/lib/wibox/widget/base.lua:495: in upvalue 'drill'
    /usr/share/awesome/lib/wibox/widget/base.lua:531: in function 'wibox.setup'
    /home/nuck/.config/awesome/themes/steamburn/theme.lua:300: in field 'at_screen_connect'
    /home/nuck/.config/awesome/rc.lua:324: in local 'func'
    /usr/share/awesome/lib/awful/screen.lua:438: in function 'awful.screen.connect_for_each_screen'
    /home/nuck/.config/awesome/rc.lua:322: in main chunk
error: /usr/share/awesome/lib/naughty/core.lua:436: attempt to compare number with table

Info

➜ awesome -v
awesome v4.3 (Too long)
 • Compiled against Lua 5.3.3 (running with Lua 5.3)
 • D-Bus support: ✔
 • execinfo support: ✔
 • xcb-randr version: 1.6
 • LGI version: 0.9.2

~ via ⬢ v10.19.0 
➜ lua -v
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio

I get the same error with both of these when adding to the wibox:

-- Weather (simplest test case)
theme.weather = lain.widget.weather({
    city_id = 2643743, -- placeholder (London)
})

-- Weather (template from awesome-copycats)
theme.weather = lain.widget.weather({
        city_id = 2643743, -- placeholder (London)
        notification_preset = { font = "Terminus 10", fg = theme.fg_normal },
        weather_na_markup = markup.fontfg(theme.font, "#eca4c4", "N/A "),
        settings = function()
            descr = weather_now["weather"][1]["description"]:lower()
            units = math.floor(weather_now["main"]["temp"])
            widget:set_markup(markup.fontfg(theme.font, "#eca4c4", descr .. " @ " .. units .. "°C "))
        end
    })

Any ideas? Cheers!

lcpz commented 3 years ago

I am unable to reproduce, with both configurations, but I spotted a wrong check in the notification.

Try 80e41c1, and if it does not work, try veryfing that the arguments given here are well-formed. If it still does not work after that, please paste me your rc.lua and theme.lua.

oxysoft commented 3 years ago

Yup, that works perfectly now!