Merge pull request #457 from quizzmaster/master

Fix notification text for calendar widget
This commit is contained in:
Luca CPZ 2020-10-27 18:07:46 +00:00 committed by GitHub
commit e578cc9796
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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