awful.widget: Add support for icon_size.

This decision was taken out of necessity. While adding more style
elements to `awful.widget.common` isn't something I want, there is
little else to do here. The problem is that popup based lists only
have size constraints in one direction. So without a way to limit
the icon size, it will take 9999 pixels.
This commit is contained in:
Emmanuel Lepage Vallee 2019-03-06 14:06:11 -05:00
parent 94e5517938
commit db2d4b92df
3 changed files with 13 additions and 0 deletions

View File

@ -161,6 +161,14 @@ function common.list_update(w, buttons, label, data, objects, args)
cache.ibm:set_margins(0)
end
if item_args.icon_size and cache.ib then
cache.ib.forced_height = item_args.icon_size
cache.ib.forced_width = item_args.icon_size
elseif cache.ib then
cache.ib.forced_height = nil
cache.ib.forced_width = nil
end
w:add(cache.primary)
end
end

View File

@ -261,6 +261,7 @@ function taglist.taglist_label(t, args)
local shape = args.shape or theme.taglist_shape
local shape_border_width = args.shape_border_width or theme.taglist_shape_border_width
local shape_border_color = args.shape_border_color or theme.taglist_shape_border_color
local icon_size = args.icon_size or theme.taglist_icon_size
-- TODO: Re-implement bg_resize
local bg_resize = false -- luacheck: ignore
local is_selected = false
@ -379,6 +380,7 @@ function taglist.taglist_label(t, args)
shape = shape,
shape_border_width = shape_border_width,
shape_border_color = shape_border_color,
icon_size = icon_size,
}
return text, bg_color, bg_image, not taglist_disable_icon and icon or nil, other_args

View File

@ -279,6 +279,7 @@ local function tasklist_label(c, args, tb)
local shape = args.shape or theme.tasklist_shape
local shape_border_width = args.shape_border_width or theme.tasklist_shape_border_width
local shape_border_color = args.shape_border_color or theme.tasklist_shape_border_color
local icon_size = args.icon_size or theme.tasklist_icon_size
-- symbol to use to indicate certain client properties
local sticky = args.sticky or theme.tasklist_sticky or ""
@ -394,6 +395,7 @@ local function tasklist_label(c, args, tb)
shape = shape,
shape_border_width = shape_border_width,
shape_border_color = shape_border_color,
icon_size = icon_size,
}
return text, bg, bg_image, not tasklist_disable_icon and c.icon or nil, other_args
@ -451,6 +453,7 @@ end
-- @tparam[opt=nil] string args.style.bg_image_urgent
-- @tparam[opt=nil] string args.style.bg_image_minimize
-- @tparam[opt=nil] boolean args.style.tasklist_disable_icon
-- @tparam[opt=nil] number args.style.icon_size The size of the icon
-- @tparam[opt=false] boolean args.style.disable_task_name
-- @tparam[opt=nil] string args.style.font
-- @tparam[opt=left] string args.style.align *left*, *right* or *center*