# Lua/AwesomeWM guidance needed.



## rigoletto@ (Apr 29, 2022)

Hello,

I'm posting in off-topic since this is not FreeBSD specific.

I decided to give a try yo x11-wm/awesome again and this time it worked greatly but there are few thing that some times drive me crazy. I suppose it has more to do with Lua programming than Awesome.

I prefer to use the procedural style than the declarative one, but sometimes I have to configure the _same thing _differently and this is not clear why.

For instance: `wibox.container.background`.

In here it work in this way:


```
local _textclock       = wibox.widget.textclock(" %A, %e %b " .. " %H:%M ")
local textclock        = wibox.container.background(_textclock)
textclock.bg           = beautiful.redbox
textclock.shape        = roundedbox
local clockwidget      = wibox.container.margin(textclock, 3, 3, 3, 3)
```

But here I have to use this `setup` thing:


```
local _mpd             = lain.widget.mpd {
        host = "10.0.0.10",
        notify = "off",
        cover_pattern = "\\.(jpg|jpeg|png|gif)$",
        settings = function()
            mpd_notification_preset.fg = "#f2f4f8"
            artist                     = mpd_now.artist
            title                      = mpd_now.title

            if mpd_now.state == "pause" then
                artist = "mpd:"
                title  = "paused"
            elseif mpd_now.state == "stop" then
                artist = "mpd:"
                title  = "stopped"
            elseif artist == "N/A" then
                artist = "mpd:"
                title  = "off"
            end

            widget:set_markup(markup.font(beautiful.altfont,
                    " " .. markup("#878d96",
                            artist) .. " " .. title .. " "))
        end
    }
    -- local mpd = wibox.container.background(_mpd)
    -- mpd.bg = beautiful.blackbox
    -- mpd.shape = roundedbox
    local mpd              = wibox.container.background()
    mpd:setup {
        _mpd,
        bg = beautiful.blackbox,
        shape = roundedbox,
        widget = wibox.container.background
    }
    local mpdwidget = wibox.container.margin(mpd, 3, 3, 3, 3)
```

I really would like to understand why?

Thank you.

*[EDIT]*

The whole configuration (at this moment).



			https://gitlab.com/rigoletto/awesomewm-dotfiles


----------

