aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/breaktimer.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/breaktimer.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/breaktimer.lua')
-rw-r--r--widgets/breaktimer.lua16
1 files changed, 2 insertions, 14 deletions
diff --git a/widgets/breaktimer.lua b/widgets/breaktimer.lua
index 698be80..e6487b8 100644
--- a/widgets/breaktimer.lua
+++ b/widgets/breaktimer.lua
@@ -21,7 +21,7 @@ local M = {}
function M.draw(cr, rect, colors)
local inner = card.card(cr, rect, colors)
local function clamp(v, lo, hi) return math.max(lo, math.min(hi, v)) end
- local LABEL_F, BIG_F, ROW_F = 0.30, 0.85, 0.32
+ local LABEL_F, BIG_F, ROW_F = 0.30, 1.0, 0.32
local bt = data.breaktimer_parse(data.slurp(CACHE) or '')
@@ -30,19 +30,7 @@ function M.draw(cr, rect, colors)
-- crash. A stopped daemon is NOT this case: the sampler still writes a cache,
-- with running no, which the card draws as 'fermo'.
if not bt then
- 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, {
- { { 'BREAKTIMER', card.FONT_MONO, LABEL_F } },
- { { 'no breaktimer data', card.FONT_UI, 0.36 } },
- { { 'bin/breaktimer-sample.sh', card.FONT_MONO, ROW_F } },
- }, 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, 'BREAKTIMER')
- card.font(cr, card.FONT_UI, S * 0.36, true)
- card.text(cr, inner.x, inner.y + S + S * LABEL_F * 2.6, 'no breaktimer data')
- card.font(cr, card.FONT_MONO, S * ROW_F, false)
- card.text(cr, inner.x, inner.y + S + S * LABEL_F * 2.6 + S * 0.72,
+ card.notice(cr, inner, colors, 'BREAKTIMER', 'no breaktimer data',
'bin/breaktimer-sample.sh')
return
end