lualua-tableawesome-wm

How to access nested widgets properties in Awesome


I'm trying to access the properties of the following widget:

local cpu_widget = wibox.widget{
    {
        max_value = 100,
        paddings = 1,
        border_width = 2,
        widget = wibox.widget.progressbar,
    },
    {
        font = beautiful.font_type .. "8",
        widget = wibox.widget.textbox,
    },
    forced_height = 100,
    forced_width  = 20,
    direction     = 'east',
    layout        = wibox.container.rotate,
}

I've tried through the conventional way, using cpu_widget[1].value or cpu_widget[2].text, but that didn't work.

Any thoughts on how I could do that?


Solution

  • See the "Accessing Widgets" on https://awesomewm.org/doc/api/documentation/03-declarative-layout.md.html (I can't seem to link to this section directly)

    Basically: You can add id = "bar" and id = "text" to your widgets and use these identifiers to retrieve the widgets again.

    In case Elv13 ever sees this answer: You did great work on the docs!