awesome-wm-widgets
awesome-wm-widgets copied to clipboard
Error in brightness-widget
Using the default rc.lua, putting the widget in the wibar using require("awesome-wm-widgets.brightness-widget.brightness")(),, without any parameters, gives the following errors:
2022-10-02 11:43:36 E: awesome: Error during a protected call: /usr/share/awesome/lib/wibox/container/arcchart.lua:111: attempt to perform arithmetic on a function value (local 'v')
stack traceback:
/usr/share/awesome/lib/wibox/container/arcchart.lua:111: in function 'wibox.container.arcchart.after_draw_children'
[C]: in function 'xpcall'
/usr/share/awesome/lib/gears/protected_call.lua:36: in function </usr/share/awesome/lib/gears/protected_call.lua:35>
(...tail calls...)
/usr/share/awesome/lib/wibox/hierarchy.lua:323: in local 'call'
/usr/share/awesome/lib/wibox/hierarchy.lua:348: in function 'wibox.hierarchy.draw'
/usr/share/awesome/lib/wibox/hierarchy.lua:345: in function 'wibox.hierarchy.draw'
/usr/share/awesome/lib/wibox/hierarchy.lua:345: in function 'wibox.hierarchy.draw'
/usr/share/awesome/lib/wibox/drawable.lua:160: in upvalue 'do_redraw'
/usr/share/awesome/lib/wibox/drawable.lua:390: in function </usr/share/awesome/lib/wibox/drawable.lua:388>
[C]: in function 'xpcall'
/usr/share/awesome/lib/gears/protected_call.lua:36: in function </usr/share/awesome/lib/gears/protected_call.lua:35>
(...tail calls...)
/usr/share/awesome/lib/gears/timer.lua:231: in function </usr/share/awesome/lib/gears/timer.lua:229>
I haven't been able to debug it further, could it be a problem with timers?
The widget still seems to be working. I'm on commit 3bb3d56c26ac3500aab33381af0cccebf6aaa05c.
Replacing the two function definitions of set_value with update_value seem to make the problem go away, and everything still works. I don't quite understand what is going on, though, because my lua knowledge is nonexistent.
Specifically changing
set_value = function(self, level)
self:set_value(level)
end,
to
update_value = function(self, level)
self:set_value(level)
end,
and
widget:set_value(brightness_level)
to
widget:update_value(brightness_level)