local P = {} P.__index = P function P:new(tagger) local widget = {} setmetatable(widget, self) widget.tagindicator = wibox.widget { homogeneous = true, spacing = beautiful.dpi(2), min_cols_size = 10, min_rows_size = 10, layout = wibox.layout.grid } -- Calculate checkbox size limit local cbox_maxsize = beautiful.dpi(conf.bar_height) cbox_maxsize = cbox_maxsize - (2 * beautiful.dpi(conf.bar_margin)) cbox_maxsize = cbox_maxsize - (tagger.rows - 1)*(beautiful.dpi(widget.tagindicator.spacing)) -- Make each tag's checkmark widget.tagindicators = {} for r=1, tagger.rows do for c=1, tagger.cols do local t = wibox.widget { widget = wibox.widget.checkbox, bg = beautiful.color.transparent, checked = false, border_width = beautiful.dpi(2), paddings = beautiful.dpi(3), color = beautiful.color.bar.active, border_color = beautiful.color.bar.inactive, } widget.tagindicators[ (c + (tagger.cols * (r - 1))) ] = t if ((conf.bar_position == "bottom") or (conf.bar_position == "top")) then cbox_maxsize = cbox_maxsize / tagger.rows else cbox_maxsize = cbox_maxsize / tagger.cols end widget.tagindicator:add_widget_at( -- The constraint container is necessary here, without it -- the checkboxes will fill all the height that is available to them. wibox.container.constraint( widget.tagindicators[(c + (tagger.cols * (r - 1)))], "exact", cbox_maxsize, cbox_maxsize ), r, c) end end -- Wrap everything with a background container widget.widget = wibox.widget { widget.tagindicator, layout = wibox.container.background } widget.widget:connect_signal("mouse::enter", function(result) widget.bg = beautiful.color.bar.hover_bg end) widget.widget:connect_signal("mouse::leave", function(result) widget.bg = beautiful.color.transparent end) return widget end return P