aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/week.lua
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-18 14:45:35 +0200
committerDanilo M. <danix@danix.xyz>2026-10-18 14:45:35 +0200
commitb4451efb0f957d3cd3d9750f903899d8a87e15f3 (patch)
tree30ba3bd158f3b77404227edffb6eda8cf1c4309e /widgets/week.lua
parent1d8b815d10e33b53c4e7d3f2668b3529a6e11c22 (diff)
downloadconky-theme-udt-b4451efb0f957d3cd3d9750f903899d8a87e15f3.tar.gz
conky-theme-udt-b4451efb0f957d3cd3d9750f903899d8a87e15f3.zip
fix(weather cards): review fixes
Hour and day labels go through weather.clock, hourly clamps rain chance and caps at 24 hours, week widens the scale by min and max together and sizes the glyph apart from the text, details compass letters never exceed row text, now always hints at the fetcher. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'widgets/week.lua')
-rw-r--r--widgets/week.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/widgets/week.lua b/widgets/week.lua
index 262121f..3cf34d1 100644
--- a/widgets/week.lua
+++ b/widgets/week.lua
@@ -19,8 +19,9 @@ local function draw_days(cr, x, y, w, h, colors, days, S)
local lo, hi = math.huge, -math.huge
for _, d in ipairs(days) do
- if d.min then lo = math.min(lo, d.min) end
- if d.max then hi = math.max(hi, d.max) end
+ if d.min and d.max then
+ lo, hi = math.min(lo, d.min, d.max), math.max(hi, d.min, d.max)
+ end
end
local span = (hi > lo) and (hi - lo) or 1
-- Columns as fractions of the width: day | glyph | min | bar | max.
@@ -33,10 +34,13 @@ local function draw_days(cr, x, y, w, h, colors, days, S)
local by = y + step * (i - 0.5) + size * 0.35 -- baseline, centred in the row
card.font(cr, card.FONT_MONO, size, false)
card.rgba(cr, colors.label)
+ local name = weather.clock(d.t, '%a')
card.text(cr, x, by, i == 1 and 'TODAY'
- or (d.t and os.date('%a', d.t):upper() or '--'))
+ or (name == '--' and name or name:upper()))
card.rgba(cr, colors.highlight)
+ card.font(cr, card.FONT_MONO, size * 1.4, false)
card.text(cr, gx, by, weather.icon(d.code, true))
+ card.font(cr, card.FONT_MONO, size, false)
card.rgba(cr, colors.value)
card.text_right(cr, minx, by, weather.deg(d.min))
card.text_right(cr, x + w, by, weather.deg(d.max))