aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/weather.lua
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/weather.lua')
-rw-r--r--widgets/weather.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/widgets/weather.lua b/widgets/weather.lua
index cd3e074..f50c6f1 100644
--- a/widgets/weather.lua
+++ b/widgets/weather.lua
@@ -123,23 +123,25 @@ function M.draw(cr, rect, colors)
-- anyway, since the stat rows run edge to edge.
local function clamp(v, lo, hi) return math.max(lo, math.min(hi, v)) end
local temp_size = clamp(inner.w * 0.135, 40, 84)
- local glyph_size = clamp(temp_size * 0.74, 30, 60)
+ local glyph_size = clamp(temp_size * 0.95, 38, 78)
local label_size = clamp(inner.w * 0.030, 12, 19)
local desc_size = clamp(inner.w * 0.038, 15, 24)
local row_size = clamp(inner.w * 0.032, 13, 20)
local row_step = row_size * 2.0
- -- 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.
+ -- Header, mirrored to match the other cards: the condition glyph large on
+ -- the left, the big temperature and the rest of the text against the right
+ -- edge. 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)
- card.text_right(cr, inner.x + inner.w, y + glyph_size * 0.95, glyph)
+ card.text(cr, inner.x, y + glyph_size * 0.95, glyph)
card.font(cr, card.FONT_HEAVY, temp_size, false)
card.rgba(cr, colors.body)
- card.text(cr, inner.x, y + temp_size * 0.86, string.format('%d\u{00B0}', math.floor(w.temp + 0.5)))
+ card.text_right(cr, inner.x + inner.w, 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 +149,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, inner.x, y + temp_size * 1.28, city)
+ card.text_right(cr, inner.x + inner.w, y + temp_size * 1.28, city)
-- Condition, in OWM's own words, first letter capitalised.
card.font(cr, card.FONT_UI, desc_size, false)
@@ -155,7 +157,7 @@ function M.draw(cr, rect, colors)
local desc = w.description or ''
desc = desc:sub(1, 1):upper() .. desc:sub(2)
local dy = y + temp_size * 1.95
- card.text(cr, inner.x, dy, desc)
+ card.text_right(cr, inner.x + inner.w, dy, desc)
-- Rule.
local ry = dy + desc_size * 1.4