I am trying to create a widget which displays the current BTC price, but the displayed widget is not updated.
First i create and register the widget with
mytextwidget = {
widget = wibox.widget.textbox,
}
btcbox = {
{
mytextwidget,
halign = "center",
layout = wibox.container.place,
},
forced_width = 100,
layout = wibox.layout.stack,
}
vicious.register(mytextwidget,vicious.contrib.btc,"$1",2,"eur")
I changed the btc widgets code, such that the indices of the returned table are numeric instead of the string "{price}", because i was not able to register it that way(maybe someone can tell me how to change the format string so that it works). I then add it to the default wibox with
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist,
-- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
batbox,
btcbox,
s.mylayoutbox,
}
}
As you can see there is also the batbox, which is setup the same way, except for registering to the vicious.widget.bat widget and this one works fine. I am new to awesomewm and especially Lua but i tried to reverse engineer through the vicious library and the text of the widget actually gets updated. I created a naughty notification which is called right after
widget.text = fmtd_data
in the init.lua of the vicious library, to display the widgets text and it is actually showing the correct result. Hopefully someone can explain it to me why this change is not displayed, thanks in advance!
Random guess without much time to try things out:
mytextwidget = {
widget = wibox.widget.textbox,
}
replace the above with
mytextwidget = wibox.widget.textbox()
Why am I suggesting this? Well, it's what is done on https://vicious.readthedocs.io/en/latest/examples.html#date-widget.