From 67e8bde37b95ae63106addc27285f7c8ef2f10ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Baumg=C3=A4rtner?= Date: Tue, 18 Oct 2022 03:12:27 +0200 Subject: [PATCH 1/2] fix cal align for short day names If the day names do not consist of three characters, the alignment is off (see https://github.com/lcpz/lain/issues/522). --- widget/cal.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/widget/cal.lua b/widget/cal.lua index 7543684..9b15038 100644 --- a/widget/cal.lua +++ b/widget/cal.lua @@ -61,7 +61,9 @@ local function factory(args) local d = os.date("*t", t) local mth_days, st_day, this_month = d.day, (d.wday-d.day-cal.week_start+1)%7, os.date("%B %Y", t) local notifytable = { [1] = string.format("%s%s\n", string.rep(" ", floor((28 - this_month:len())/2)), markup.bold(this_month)) } - for x = 0,6 do notifytable[#notifytable+1] = os.date("%a", os.time { year=2006, month=1, day=x+cal.week_start }):sub(1, utf8.offset(1, 3)) .. " " end + for day_num = 0, 6 do + notifytable[#notifytable+1] = string.format("%3s ", os.date("%a", os.time { year = 2006, month = 1, day = day_num + cal.week_start })) + end notifytable[#notifytable] = string.format("%s\n%s", notifytable[#notifytable]:sub(1, -2), string.rep(" ", st_day*4)) local strx for x = 1,mth_days do From d2ac6f308d8eb53ae499a4447ce3c4b687783720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Baumg=C3=A4rtner?= Date: Tue, 18 Oct 2022 21:55:35 +0200 Subject: [PATCH 2/2] removes the utf-8 dependency Should fix https://github.com/lcpz/lain/issues/503 --- widget/cal.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/widget/cal.lua b/widget/cal.lua index 9b15038..97dced8 100644 --- a/widget/cal.lua +++ b/widget/cal.lua @@ -17,7 +17,6 @@ local tconcat = table.concat local type = type local tonumber = tonumber local tostring = tostring -local utf8 = utf8 -- Calendar notification -- lain.widget.cal