naughty: allow icon to be an image object
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
56e7262cc5
commit
311a485319
|
@ -337,13 +337,20 @@ function notify(args)
|
||||||
local iconbox = nil
|
local iconbox = nil
|
||||||
if icon then
|
if icon then
|
||||||
-- try to guess icon if the provided one is non-existent/readable
|
-- 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 we have an icon, use it
|
||||||
if icon then
|
if icon then
|
||||||
iconbox = widget({ type = "imagebox", align = "left" })
|
iconbox = widget({ type = "imagebox", align = "left" })
|
||||||
iconbox:buttons({ button({ }, 1, run), button({ }, 3, die) })
|
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
|
if icon_size then
|
||||||
img = img:crop_and_scale(0,0,img.height,img.width,icon_size,icon_size)
|
img = img:crop_and_scale(0,0,img.height,img.width,icon_size,icon_size)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue