local string = { format = string.format,
gsub = string.gsub }
local tonumber = tonumber
-local setmetatable = setmetatable
-- Calendar notification
-- lain.widgets.calendar
calendar.notification_preset.screen = src or 1
end
- async(string.format("%s -c '%s'", awful.util.shell, f), function(ws)
+ async(f, function(ws)
fg, bg = calendar.notification_preset.fg, calendar.notification_preset.bg
ws = ws:gsub("%c%[7m%d+%c%[27m", markup.bold(markup.color(bg, fg, today)))
calendar.notification = naughty.notify({
calendar.notification_preset.bg = "#000000"
end
- widget:connect_signal("mouse::enter", function () calendar.show(0, 0, calendar.scr_pos) end)
- widget:connect_signal("mouse::leave", function () calendar.hide() end)
- widget:buttons(awful.util.table.join(awful.button({ }, 1, function ()
- calendar.show(0, -1, calendar.scr_pos) end),
- awful.button({ }, 3, function ()
- calendar.show(0, 1, calendar.scr_pos) end),
- awful.button({ }, 4, function ()
- calendar.show(0, -1, calendar.scr_pos) end),
- awful.button({ }, 5, function ()
- calendar.show(0, 1, calendar.scr_pos) end)))
+ if widget then
+ widget:connect_signal("mouse::enter", function () calendar.show(0) end)
+ widget:connect_signal("mouse::leave", function () calendar.hide() end)
+ widget:buttons(awful.util.table.join(awful.button({ }, 1, function ()
+ calendar.show(0, -1, calendar.scr_pos) end),
+ awful.button({ }, 3, function ()
+ calendar.show(0, 1, calendar.scr_pos) end),
+ awful.button({ }, 4, function ()
+ calendar.show(0, -1, calendar.scr_pos) end),
+ awful.button({ }, 5, function ()
+ calendar.show(0, 1, calendar.scr_pos) end)))
+ end
end
-return setmetatable(calendar, { __call = function(_, ...) return create(...) end })
+return calendar