Fix notification text for calendar widget

This commit is contained in:
Sebastian Lenz 2020-06-10 14:29:57 +02:00
parent e0bffc0056
commit 89b3d66d8f

View file

@ -126,14 +126,14 @@ local function factory(args)
end end
function cal.show(seconds, month, year, scr) function cal.show(seconds, month, year, scr)
cal.notification_preset.text = tconcat(cal.build(month, year)) local text = tconcat(cal.build(month, year))
if cal.three then if cal.three then
local current_month, current_year = cal.month, cal.year local current_month, current_year = cal.month, cal.year
local prev_month, prev_year = cal.getdate(cal.month, cal.year, -1) local prev_month, prev_year = cal.getdate(cal.month, cal.year, -1)
local next_month, next_year = cal.getdate(cal.month, cal.year, 1) local next_month, next_year = cal.getdate(cal.month, cal.year, 1)
cal.notification_preset.text = string.format("%s\n\n%s\n\n%s", text = string.format("%s\n\n%s\n\n%s",
tconcat(cal.build(prev_month, prev_year)), cal.notification_preset.text, tconcat(cal.build(prev_month, prev_year)), text,
tconcat(cal.build(next_month, next_year))) tconcat(cal.build(next_month, next_year)))
cal.month, cal.year = current_month, current_year cal.month, cal.year = current_month, current_year
end end
@ -143,7 +143,8 @@ local function factory(args)
preset = cal.notification_preset, preset = cal.notification_preset,
screen = cal.followtag and awful.screen.focused() or scr or 1, screen = cal.followtag and awful.screen.focused() or scr or 1,
icon = cal.icon, icon = cal.icon,
timeout = type(seconds) == "number" and seconds or cal.notification_preset.timeout or 5 timeout = type(seconds) == "number" and seconds or cal.notification_preset.timeout or 5,
text = text
} }
end end