I want to create a simple widget which is a progress bar that gets its value set to 1 when we click it with left mouse button.
local myFirstWidget = wibox.widget {
{
value = 0.5,
color = "#ff0000",
widget = wibox.widget.progressbar,
width = 100,
forced_height = 20,
shape = gears.shape.rounded_bar,
border_width = 2,
border_color = beautiful.border_color,
ticks = true,
clip = true,
margins = {top = 5, bottom = 5},
paddings = 2
},
layout = wibox.layout.fixed.horizontal
}
myFirstWidget:connect_signal("button::press",
function(w, _, _, btn) w.value = 1 end)
When I press the bar - nothing really happens. And if I use
w.set_value(1)
then clicking the bar shows an error
attempt to call a nil value (field 'set_value')
How do I make it work?