X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/49a4df385e953156e6d1e2ee0bcfd07d8501d0f4..555b872d16393774089df3b3453000571a73a3dd:/widgets/calendar.lua diff --git a/widgets/calendar.lua b/widgets/calendar.lua index 3ad3498..032b1fb 100644 --- a/widgets/calendar.lua +++ b/widgets/calendar.lua @@ -20,9 +20,7 @@ local tonumber = tonumber local calendar = { offset = 0 } function calendar.hide() - if not calendar.notification then return end - naughty.destroy(calendar.notification) - calendar.notification = nil + naughty.destroy(naughty.getById(calendar.id)) end function calendar.show(t_out, inc_offset, scr) @@ -69,12 +67,13 @@ function calendar.show(t_out, inc_offset, scr) helpers.async(f, function(ws) fg, bg = calendar.notification_preset.fg, calendar.notification_preset.bg ws = ws:gsub("%c%[%d+[m]?%d+%c%[%d+[m]?", markup.bold(markup.color(bg, fg, today))) - calendar.notification = naughty.notify({ - preset = calendar.notification_preset, - text = ws:gsub("\n*$", ""), - icon = calendar.notify_icon, - timeout = t_out or calendar.notification.preset.timeout or 5 - }) + calendar.id = naughty.notify({ + replaces_id = calendar.id, + preset = calendar.notification_preset, + text = ws:gsub("\n*$", ""), + icon = calendar.notify_icon, + timeout = t_out or calendar.notification.preset.timeout or 5 + }).id end) end