taglist: Add shape support

This commit is contained in:
Emmanuel Lepage Vallee 2016-08-05 01:13:58 -04:00
parent da47357ae7
commit 967fc87a92
1 changed files with 48 additions and 1 deletions

View File

@ -56,6 +56,9 @@ function taglist.taglist_label(t, args)
local fg_color = nil local fg_color = nil
local bg_image local bg_image
local icon local icon
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
-- TODO: Re-implement bg_resize -- TODO: Re-implement bg_resize
local bg_resize = false -- luacheck: ignore local bg_resize = false -- luacheck: ignore
local is_selected = false local is_selected = false
@ -91,15 +94,53 @@ function taglist.taglist_label(t, args)
end end
if bg_empty then bg_color = bg_empty end if bg_empty then bg_color = bg_empty end
if fg_empty then fg_color = fg_empty end if fg_empty then fg_color = fg_empty end
if args.shape_empty or theme.taglist_shape_empty then
shape = args.shape_empty or theme.taglist_shape_empty
end
if args.shape_border_width_empty or theme.taglist_shape_border_width_empty then
shape_border_width = args.shape_border_width_empty or theme.taglist_shape_border_width_empty
end
if args.shape_border_color_empty or theme.taglist_shape_border_color_empty then
shape_border_color = args.shape_border_color_empty or theme.taglist_shape_border_color_empty
end
end end
end end
if t.selected then if t.selected then
bg_color = bg_focus bg_color = bg_focus
fg_color = fg_focus fg_color = fg_focus
if args.shape_focus or theme.taglist_shape_focus then
shape = args.shape_focus or theme.taglist_shape_focus
end
if args.shape_border_width_focus or theme.taglist_shape_border_width_focus then
shape = args.shape_border_width_focus or theme.taglist_shape_border_width_focus
end
if args.shape_border_color_focus or theme.taglist_shape_border_color_focus then
shape = args.shape_border_color_focus or theme.taglist_shape_border_color_focus
end
elseif tag.getproperty(t, "urgent") then elseif tag.getproperty(t, "urgent") then
if bg_urgent then bg_color = bg_urgent end if bg_urgent then bg_color = bg_urgent end
if fg_urgent then fg_color = fg_urgent end if fg_urgent then fg_color = fg_urgent end
if args.shape_urgent or theme.taglist_shape_urgent then
shape = args.shape_urgent or theme.taglist_shape_urgent
end
if args.shape_border_width_urgent or theme.taglist_shape_border_width_urgent then
shape_border_width = args.shape_border_width_urgent or theme.taglist_shape_border_width_urgent
end
if args.shape_border_color_urgent or theme.taglist_shape_border_color_urgent then
shape_border_color = args.shape_border_color_urgent or theme.taglist_shape_border_color_urgent
end
end end
if not tag.getproperty(t, "icon_only") then if not tag.getproperty(t, "icon_only") then
text = "<span font_desc='"..font.."'>" text = "<span font_desc='"..font.."'>"
if fg_color then if fg_color then
@ -116,7 +157,13 @@ function taglist.taglist_label(t, args)
end end
end end
return text, bg_color, bg_image, not taglist_disable_icon and icon or nil local other_args = {
shape = shape,
shape_border_width = shape_border_width,
shape_border_color = shape_border_color,
}
return text, bg_color, bg_image, not taglist_disable_icon and icon or nil, other_args
end end
local function taglist_update(s, w, buttons, filter, data, style, update_function) local function taglist_update(s, w, buttons, filter, data, style, update_function)