aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/calendar.lua
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-18 18:41:31 +0200
committerDanilo M. <danix@danix.xyz>2026-09-18 18:41:31 +0200
commit7fddddcd39bb250cd2653e130c8f7899d2d3f19c (patch)
treeca427df07676563853fb7f25f6ce4eb14e63a25b /widgets/calendar.lua
parent37cabe2fea2f86d481516aae6ddaeb14bac2e64f (diff)
downloadconky-theme-udt-7fddddcd39bb250cd2653e130c8f7899d2d3f19c.tar.gz
conky-theme-udt-7fddddcd39bb250cd2653e130c8f7899d2d3f19c.zip
refactor: unify card no-data face and fluid sizing
Extract card.notice so every cached card's no-data state is one fluid, theme-consistent face instead of a copy per widget, and delete the fixed-size card.label it replaces. Derive weather's arc geometry from its band (pad, curve room, sun dot, time labels) instead of fixed pixels, and cap the arc at a proportion of the card's width rather than 240px. Derive disks' bar-fallback height and its address type from the card's own label scale. Standardise the big-value factor to 1.0 across the fit_unit cards and document the big-value colour rule and the disks headline exception.
Diffstat (limited to 'widgets/calendar.lua')
-rw-r--r--widgets/calendar.lua20
1 files changed, 1 insertions, 19 deletions
diff --git a/widgets/calendar.lua b/widgets/calendar.lua
index 6194447..b31e3b2 100644
--- a/widgets/calendar.lua
+++ b/widgets/calendar.lua
@@ -52,24 +52,6 @@ local function when(e)
return string.format('%02d/%02d %s', e.d, e.m, e.start or 'all day')
end
--- The failure face: the sampler has not run. Named, as the other cached cards
--- do, rather than a blank cell that cannot be told from a crashed widget.
-local function draw_empty(cr, inner, colors, label_f, note, hint)
- local S = clamp(inner.h * 0.94 / (1.78 + 2 * 0.72), 10, 72)
- S = math.min(S, card.fit_unit(cr, inner.w * 0.96, {
- { { 'CALENDAR', card.FONT_MONO, label_f } },
- { { note, card.FONT_UI, 0.36 } },
- { { hint, card.FONT_MONO, 0.32 } },
- }, 100))
- card.font(cr, card.FONT_MONO, S * label_f, false)
- card.rgba(cr, colors.label)
- card.text(cr, inner.x, inner.y + S * label_f, 'CALENDAR')
- card.font(cr, card.FONT_UI, S * 0.36, true)
- card.text(cr, inner.x, inner.y + S + S * label_f * 2.6, note)
- card.font(cr, card.FONT_MONO, S * 0.32, false)
- card.text(cr, inner.x, inner.y + S + S * label_f * 2.6 + S * 0.72, hint)
-end
-
-- The legend: one coloured dot and name per calendar, along the card's bottom.
-- Wraps to a second line when the names do not fit, and drops any that still
-- do not: a legend spilling off the card is worse than a short one, since the
@@ -103,7 +85,7 @@ function M.draw(cr, rect, colors)
local cal = data.calendar_parse(data.slurp(CACHE) or '')
if not cal then
- draw_empty(cr, inner, colors, LABEL_F, 'no calendar data',
+ card.notice(cr, inner, colors, 'CALENDAR', 'no calendar data',
'bin/calendar-sample.sh')
return
end