X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/3f854a45f578f0a93d9f561bb8d7f574ab5675ee..5f32175e3d98e64bf3caadcfce016740a154b6cc:/widget/calendar.lua diff --git a/widget/calendar.lua b/widget/calendar.lua index eec14e7..ce2d346 100644 --- a/widget/calendar.lua +++ b/widget/calendar.lua @@ -79,13 +79,14 @@ function calendar.show(t_out, inc_offset, scr) end end - calendar.hide() - - calendar.notification = naughty.notify({ - preset = calendar.notification_preset, - icon = calendar.icon, - timeout = (widget_focused and t_out) or calendar.notification_preset.timeout or 5 - }) + if widget_focused then + calendar.hide() + calendar.notification = naughty.notify({ + preset = calendar.notification_preset, + icon = calendar.icon, + timeout = t_out or calendar.notification_preset.timeout or 5 + }) + end end) end @@ -98,7 +99,7 @@ function calendar.attach(widget) awful.button({ }, 5, function () calendar.show(0, 1) end))) end -local function worker(args) +local function factory(args) local args = args or {} calendar.cal = args.cal or "/usr/bin/cal" calendar.attach_to = args.attach_to or {} @@ -117,4 +118,4 @@ local function worker(args) for i, widget in ipairs(calendar.attach_to) do calendar.attach(widget) end end -return setmetatable(calendar, { __call = function(_, ...) return worker(...) end }) +return setmetatable(calendar, { __call = function(_, ...) return factory(...) end })