make tag preview fallback to a awesomewm icon

This commit is contained in:
undefinedDarkness 2021-09-27 17:04:40 +05:30
parent 7277f57730
commit 0a49f7ff43
1 changed files with 7 additions and 2 deletions

View File

@ -36,14 +36,19 @@ local function draw_widget(
local tag_screen = t.screen local tag_screen = t.screen
for i, c in ipairs(t:clients()) do for i, c in ipairs(t:clients()) do
if not c.hidden and not c.minimized then if not c.hidden and not c.minimized then
local img_box = wibox.widget({
image = gears.surface.load(c.icon), local img_box = wibox.widget ({
resize = true, resize = true,
forced_height = 100 * scale, forced_height = 100 * scale,
forced_width = 100 * scale, forced_width = 100 * scale,
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
}) })
-- If fails to set image, fallback to a awesome icon
if not pcall(function() img_box.image = gears.surface.load(c.icon) end) then
img_box.image = beautiful.theme_assets.awesome_icon (24, "#222222", "#fafafa")
end
if tag_preview_image then if tag_preview_image then
if c.prev_content or t.selected then if c.prev_content or t.selected then
local content local content