luawindow-managersawesome-wm

Awesome-WM - How to center a wibox.widget.textbox in a wibox.container?


I would like to know how to center a wibox.widget.textbox in wibox.container.background, because I would like to center the text in this image.

s.mytaglist = awful.widget.taglist {
    screen  = s,
    filter  = awful.widget.taglist.filter.all,
    buttons = tag_list_buttons,
    widget_template = {
        id = 'background_role',
        widget = wibox.container.background,
        forced_width = 40,
        {
            layout = wibox.layout.fixed.horizontal,
            {
                id = 'text_role',
                widget = wibox.widget.textbox,
            },
        },
    },
}

I have try to add expand = "outside" but that doesn't work. Also, I doesn't want to use a wibox.container.margin, because it's not precise enough.

Thanks in advance for your help.


Solution

  • Set the align and valign properties of the textbox to "center" for horizontal and vertical center alignment.