diff options
| -rw-r--r-- | widgets/weather.lua | 12 |
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) |
