naugthy: Force reload the surface when the icon changes.

Fixes #2851
This commit is contained in:
Emmanuel Lepage Vallee 2023-12-29 18:08:06 -08:00
parent 271e6c3cc9
commit 4533bb00bd
1 changed files with 12 additions and 8 deletions

View File

@ -162,28 +162,32 @@ end
local function new(args) local function new(args)
args = args or {} args = args or {}
local tb = imagebox() local ib = imagebox()
gtable.crush(tb, icon, true) gtable.crush(ib, icon, true)
tb._private.notification = {} ib._private.notification = {}
function tb._private.icon_changed_callback() function ib._private.icon_changed_callback()
local n = tb._private.notification[1] local n = ib._private.notification[1]
if not n then return end if not n then return end
local icn = gsurface.load_silently(n.icon) local icn = gsurface.load_silently(n.icon)
if icn then if icn then
tb:set_image(icn) ib:set_image(icn)
-- Some clients will write the image to the same path over and
-- over, but the content will change.
ib:refresh()
end end
end end
if args.notification then if args.notification then
tb:set_notification(args.notification) ib:set_notification(args.notification)
end end
return tb return ib
end end
--@DOC_object_COMMON@ --@DOC_object_COMMON@