doc: Improve the `awful` template.

* Support client shape
 * Support titlebar colors
 * Only render clients part of the selected tag(s).
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-16 18:56:31 -07:00
parent fd8401a399
commit 73625168f2
1 changed files with 26 additions and 4 deletions

View File

@ -98,10 +98,20 @@ local total_area = wibox.layout {
} }
local function wrap_titlebar(tb, width, height) local function wrap_titlebar(tb, width, height)
local bg, fg
if args.honor_titlebar_colors then
bg = tb.drawable.background_color or tb.args.bg_normal
fg = tb.drawable.foreground_color or tb.args.fg_normal
else
bg, fg = tb.args.bg_normal, tb.args.fg_normal
end
return wibox.widget { return wibox.widget {
tb.drawable.widget, tb.drawable.widget,
bg = tb.args.bg_normal, bg = bg,
fg = tb.args.fg_normal, fg = fg,
forced_width = width, forced_width = width,
forced_height = height, forced_height = height,
widget = wibox.container.background widget = wibox.container.background
@ -160,10 +170,15 @@ local function client_widget(c, col, label)
border_color = bc, border_color = bc,
shape_clip = true, shape_clip = true,
border_strategy = "inner", border_strategy = "inner",
opacity = c.opacity,
fg = beautiful.fg_normal or "#000000", fg = beautiful.fg_normal or "#000000",
bg = col, bg = col,
shape = function(cr2, w, h) shape = function(cr2, w, h)
if c.shape then
c.shape(cr2, w, h)
else
return shape.rounded_rect(cr2, w, h, args.radius or 5) return shape.rounded_rect(cr2, w, h, args.radius or 5)
end
end, end,
forced_width = geo.width + 2*bw, forced_width = geo.width + 2*bw,
@ -201,7 +216,14 @@ end
-- Loop each clients geometry history and paint it -- Loop each clients geometry history and paint it
for _, c in ipairs(client.get()) do for _, c in ipairs(client.get()) do
if not c.minimized then
local is_displayed = false
for _, t in pairs(c:tags()) do
is_displayed = is_displayed or t.selected
end
if (not c.minimized) and is_displayed then
local pgeo = nil local pgeo = nil
for _, geo in ipairs(c._old_geo) do for _, geo in ipairs(c._old_geo) do
if not geo._hide then if not geo._hide then