aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-17 09:52:12 +0200
committerDanilo M. <danix@danix.xyz>2026-09-17 09:52:12 +0200
commit182f36b81e408569ec20d109ec558d2432403264 (patch)
tree8e92561e167a186a5d3c070767ca52177e5ded7e /widgets
parentccf7329493788130341c5a6f8223448dc1bb2286 (diff)
downloadconky-theme-udt-182f36b81e408569ec20d109ec558d2432403264.tar.gz
conky-theme-udt-182f36b81e408569ec20d109ec558d2432403264.zip
feat: right-align the condition glyph
Temperature and city stay against the left edge; the glyph moves to the right edge, so the header reads as a value on one side and its icon on the other rather than one run of text. text_right takes the right edge as its x and measures ink, which is what aligning to an edge wants, as against advance() for stepping a cursor. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/weather.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/widgets/weather.lua b/widgets/weather.lua
index 50d0e10..cd3e074 100644
--- a/widgets/weather.lua
+++ b/widgets/weather.lua
@@ -129,17 +129,17 @@ function M.draw(cr, rect, colors)
local row_size = clamp(inner.w * 0.032, 13, 20)
local row_step = row_size * 2.0
- -- Header: condition glyph, then the temperature with the city beneath it.
+ -- Header: temperature and city against the left edge, condition glyph
+ -- against the right. text_right takes the RIGHT edge as its x, and measures
+ -- ink rather than advance, which is what you want for aligning to an edge.
local glyph = weather.icon(w.id, now, w.sunrise, w.sunset)
card.font(cr, card.FONT_MONO, glyph_size, false)
card.rgba(cr, colors.highlight)
- local gy = y + glyph_size * 0.95
- card.text(cr, inner.x, gy, glyph)
- local gx = inner.x + card.advance(cr, glyph) + glyph_size * 0.4
+ card.text_right(cr, inner.x + inner.w, y + glyph_size * 0.95, glyph)
card.font(cr, card.FONT_HEAVY, temp_size, false)
card.rgba(cr, colors.body)
- card.text(cr, gx, y + temp_size * 0.86, string.format('%d\u{00B0}', math.floor(w.temp + 0.5)))
+ card.text(cr, inner.x, y + temp_size * 0.86, string.format('%d\u{00B0}', math.floor(w.temp + 0.5)))
card.font(cr, card.FONT_MONO, label_size, false)
card.rgba(cr, colors.label)
@@ -147,7 +147,7 @@ function M.draw(cr, rect, colors)
if weather.is_stale(w.dt, now) then
city = city .. ' stale ' .. weather.age_str(w.dt, now)
end
- card.text(cr, gx, y + temp_size * 1.28, city)
+ card.text(cr, inner.x, y + temp_size * 1.28, city)
-- Condition, in OWM's own words, first letter capitalised.
card.font(cr, card.FONT_UI, desc_size, false)