From 0a49f7ff43ac7d0cb592b4cb2805f64f91b61a71 Mon Sep 17 00:00:00 2001 From: undefinedDarkness Date: Mon, 27 Sep 2021 17:04:40 +0530 Subject: [PATCH] make tag preview fallback to a awesomewm icon --- widget/tag_preview.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/widget/tag_preview.lua b/widget/tag_preview.lua index f2ef42b..52ee80d 100644 --- a/widget/tag_preview.lua +++ b/widget/tag_preview.lua @@ -36,14 +36,19 @@ local function draw_widget( local tag_screen = t.screen for i, c in ipairs(t:clients()) do 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, forced_height = 100 * scale, forced_width = 100 * scale, 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 c.prev_content or t.selected then local content