From 311a485319c0816ba7ce90b0f08c155291b3f9f3 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 11 Mar 2009 17:11:06 +0100 Subject: [PATCH] naughty: allow icon to be an image object Signed-off-by: Julien Danjou --- lib/naughty.lua.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 3d34b44e5..4d179f054 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -337,13 +337,20 @@ function notify(args) local iconbox = nil if icon then -- try to guess icon if the provided one is non-existent/readable - if not awful.util.file_readable(icon) then icon = getIcon(icon) end + if type(icon) == "string" and not awful.util.file_readable(icon) then + icon = getIcon(icon) + end -- if we have an icon, use it if icon then iconbox = widget({ type = "imagebox", align = "left" }) iconbox:buttons({ button({ }, 1, run), button({ }, 3, die) }) - local img = image(icon) + local img + if type(icon) == "string" then + img = image(icon) + else + img = icon + end if icon_size then img = img:crop_and_scale(0,0,img.height,img.width,icon_size,icon_size) end