Merge pull request #133 from undefinedDarkness/add_icon_fallback

make tag preview fallback to a awesomewm icon
This commit is contained in:
contribuewwt 2021-11-04 21:47:57 +05:30 committed by GitHub
commit 0d8df18e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -37,14 +37,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