tasklist: Fix `disable_icon`.

It regressed when the tasklist switched to a template by default.
This was done to support the icon size.

Fix #3178
This commit is contained in:
Emmanuel Lepage Vallee 2021-11-13 00:14:29 -08:00
parent b8dbba34db
commit c7ed176586
1 changed files with 91 additions and 26 deletions

View File

@ -211,78 +211,136 @@ local instances
-- @beautiful beautiful.tasklist_minimized -- @beautiful beautiful.tasklist_minimized
-- @tparam[opt=nil] string minimized -- @tparam[opt=nil] string minimized
--- The tasklist font.
-- @beautiful beautiful.tasklist_font
-- @tparam[opt=nil] string font
--- The focused client alignment. --- The focused client alignment.
--
-- @DOC_wibox_awidget_tasklist_style_align_EXAMPLE@
--
-- @beautiful beautiful.tasklist_align -- @beautiful beautiful.tasklist_align
-- @tparam[opt=left] string align *left*, *right* or *center* -- @tparam[opt=left] string align *left*, *right* or *center*
--- The tasklist font.
--
-- @DOC_wibox_awidget_tasklist_style_font_EXAMPLE@
--
-- @beautiful beautiful.tasklist_font
-- @tparam[opt=nil] string font
-- @see wibox.widget.textbox.font
--- The focused client title alignment. --- The focused client title alignment.
--
-- @DOC_wibox_awidget_tasklist_style_font_focus_EXAMPLE@
--
-- @beautiful beautiful.tasklist_font_focus -- @beautiful beautiful.tasklist_font_focus
-- @tparam[opt=nil] string font_focus -- @tparam[opt=nil] string font_focus
-- @see wibox.widget.textbox.font
--- The minimized clients font. --- The minimized clients font.
--
-- @DOC_wibox_awidget_tasklist_style_font_minimized_EXAMPLE@
--
-- @beautiful beautiful.tasklist_font_minimized -- @beautiful beautiful.tasklist_font_minimized
-- @tparam[opt=nil] string font_minimized -- @tparam[opt=nil] string font_minimized
-- @see wibox.widget.textbox.font
--- The urgent clients font. --- The urgent clients font.
--
-- @DOC_wibox_awidget_tasklist_style_font_urgent_EXAMPLE@
--
-- @beautiful beautiful.tasklist_font_urgent -- @beautiful beautiful.tasklist_font_urgent
-- @tparam[opt=nil] string font_urgent -- @tparam[opt=nil] string font_urgent
-- @see wibox.widget.textbox.font
--- The space between the tasklist elements. --- The space between the tasklist elements.
--
-- @DOC_wibox_awidget_tasklist_style_spacing_EXAMPLE@
--
-- @beautiful beautiful.tasklist_spacing -- @beautiful beautiful.tasklist_spacing
-- @tparam[opt=0] number spacing The spacing between tasks. -- @tparam[opt=0] number spacing The spacing between tasks.
--- The default tasklist elements shape. --- The default tasklist elements shape.
--
-- @DOC_wibox_awidget_tasklist_style_shape_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape -- @beautiful beautiful.tasklist_shape
-- @tparam[opt=nil] gears.shape shape -- @tparam[opt=nil] gears.shape shape
--- The default tasklist elements border width. --- The default tasklist elements border width.
--
-- @DOC_wibox_awidget_tasklist_style_shape_border_width_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_width -- @beautiful beautiful.tasklist_shape_border_width
-- @tparam[opt=0] number shape_border_width -- @tparam[opt=0] number shape_border_width
--- The default tasklist elements border color. --- The default tasklist elements border color.
--
-- @DOC_wibox_awidget_tasklist_style_shape_border_color_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_color -- @beautiful beautiful.tasklist_shape_border_color
-- @tparam[opt=nil] string|color shape_border_color -- @tparam[opt=nil] string|color shape_border_color
-- @see gears.color -- @see gears.color
--- The focused client shape. --- The focused client shape.
--
-- @DOC_wibox_awidget_tasklist_style_shape_focus_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_focus -- @beautiful beautiful.tasklist_shape_focus
-- @tparam[opt=nil] gears.shape shape_focus -- @tparam[opt=nil] gears.shape shape_focus
--- The focused client border width. --- The focused client border width.
--
-- @DOC_wibox_awidget_tasklist_style_shape_focus_border_width_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_width_focus -- @beautiful beautiful.tasklist_shape_border_width_focus
-- @tparam[opt=0] number shape_border_width_focus -- @tparam[opt=0] number shape_border_width_focus
--- The focused client border color. --- The focused client border color.
--
-- @DOC_wibox_awidget_tasklist_style_shape_focus_border_width_focus_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_color_focus -- @beautiful beautiful.tasklist_shape_border_color_focus
-- @tparam[opt=nil] string|color shape_border_color_focus -- @tparam[opt=nil] string|color shape_border_color_focus
-- @see gears.color -- @see gears.color
--- The minimized clients shape. --- The minimized clients shape.
--
-- @DOC_wibox_awidget_tasklist_style_shape_minimized_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_minimized -- @beautiful beautiful.tasklist_shape_minimized
-- @tparam[opt=nil] gears.shape shape_minimized -- @tparam[opt=nil] gears.shape shape_minimized
--- The minimized clients border width. --- The minimized clients border width.
--
-- @DOC_wibox_awidget_tasklist_style_shape_border_width_minimized_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_width_minimized -- @beautiful beautiful.tasklist_shape_border_width_minimized
-- @tparam[opt=0] number shape_border_width_minimized -- @tparam[opt=0] number shape_border_width_minimized
--- The minimized clients border color. --- The minimized clients border color.
--
-- @DOC_wibox_awidget_tasklist_style_shape_border_color_minimized_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_color_minimized -- @beautiful beautiful.tasklist_shape_border_color_minimized
-- @tparam[opt=nil] string|color shape_border_color_minimized -- @tparam[opt=nil] string|color shape_border_color_minimized
-- @see gears.color -- @see gears.color
--- The urgent clients shape. --- The urgent clients shape.
--
-- @DOC_wibox_awidget_tasklist_style_shape_urgent_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_urgent -- @beautiful beautiful.tasklist_shape_urgent
-- @tparam[opt=nil] gears.shape shape_urgent -- @tparam[opt=nil] gears.shape shape_urgent
--- The urgent clients border width. --- The urgent clients border width.
--
-- @DOC_wibox_awidget_tasklist_style_shape_border_width_urgent_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_width_urgent -- @beautiful beautiful.tasklist_shape_border_width_urgent
-- @tparam[opt=0] number shape_border_width_urgent -- @tparam[opt=0] number shape_border_width_urgent
--- The urgent clients border color. --- The urgent clients border color.
--
-- @DOC_wibox_awidget_tasklist_style_shape_border_color_urgent_EXAMPLE@
--
-- @beautiful beautiful.tasklist_shape_border_color_urgent -- @beautiful beautiful.tasklist_shape_border_color_urgent
-- @tparam[opt=nil] string|color shape_border_color_urgent -- @tparam[opt=nil] string|color shape_border_color_urgent
-- @see gears.color -- @see gears.color
@ -291,14 +349,19 @@ local instances
tasklist.filter, tasklist.source = {}, {} tasklist.filter, tasklist.source = {}, {}
-- This is the same template as awful.widget.common, but with an clienticon widget -- This is the same template as awful.widget.common, but with an clienticon widget
local default_template = { local function default_template(self)
{ local has_no_icon = self._private.style.disable_icon
or self._private.style.tasklist_disable_icon
or beautiful.tasklist_disable_icon
return {
{ {
(not has_no_icon) and {
clienticon, clienticon,
id = "icon_margin_role", id = "icon_margin_role",
left = dpi(4), left = dpi(4),
widget = wmargin widget = wmargin
}, } or nil,
{ {
{ {
id = "text_role", id = "text_role",
@ -314,7 +377,8 @@ local default_template = {
}, },
id = "background_role", id = "background_role",
widget = wbackground widget = wbackground
} }
end
local function tasklist_label(c, args, tb) local function tasklist_label(c, args, tb)
if not args then args = {} end if not args then args = {} end
@ -492,14 +556,15 @@ local function tasklist_update(s, self, buttons, filter, data, style, update_fun
end end
if self._private.last_count ~= #clients then if self._private.last_count ~= #clients then
self:emit_signal("property::count", #clients, self._private.last_count) local old = self._private.last_count
self._private.last_count = #clients self._private.last_count = #clients
self:emit_signal("property::count", #clients, old)
end end
local function label(c, tb) return tasklist_label(c, style, tb) end local function label(c, tb) return tasklist_label(c, style, tb) end
update_function(self._private.base_layout, buttons, label, data, clients, { update_function(self._private.base_layout, buttons, label, data, clients, {
widget_template = self._private.widget_template or default_template, widget_template = self._private.widget_template or default_template(self),
create_callback = create_callback, create_callback = create_callback,
}) })
end end