naughty.widget.icon: Use `surface.load_silently`.
Icons can be names from the icon theme. This wont load until a better icon theme API is added (since this module doesn't depend on menubar).
This commit is contained in:
parent
e076bc664e
commit
2ff4a5294c
|
@ -19,6 +19,7 @@
|
||||||
local imagebox = require("wibox.widget.imagebox")
|
local imagebox = require("wibox.widget.imagebox")
|
||||||
local gtable = require("gears.table")
|
local gtable = require("gears.table")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
local gsurface = require("gears.surface")
|
||||||
local dpi = require("beautiful.xresources").apply_dpi
|
local dpi = require("beautiful.xresources").apply_dpi
|
||||||
|
|
||||||
local icon = {}
|
local icon = {}
|
||||||
|
@ -85,7 +86,11 @@ function icon:set_notification(notif)
|
||||||
self._private.icon_changed_callback)
|
self._private.icon_changed_callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:set_image(notif.icon)
|
local icn = gsurface.load_silently(notif.icon)
|
||||||
|
|
||||||
|
if icn then
|
||||||
|
self:set_image(icn)
|
||||||
|
end
|
||||||
|
|
||||||
self._private.notification = notif
|
self._private.notification = notif
|
||||||
|
|
||||||
|
@ -141,7 +146,11 @@ local function new(args)
|
||||||
gtable.crush(tb, icon, true)
|
gtable.crush(tb, icon, true)
|
||||||
|
|
||||||
function tb._private.icon_changed_callback()
|
function tb._private.icon_changed_callback()
|
||||||
tb:set_image(tb._private.notification.icon)
|
local icn = gsurface.load_silently(tb._private.notification.icon)
|
||||||
|
|
||||||
|
if icn then
|
||||||
|
tb:set_image()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.notification then
|
if args.notification then
|
||||||
|
|
Loading…
Reference in New Issue