diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-18 15:12:02 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-18 15:12:02 +0200 |
| commit | 403c76a77ff66dac9f84fa9a49d415a8e2442cee (patch) | |
| tree | 8406605627d6c13b8fbf3f6732236657f2825533 | |
| parent | f47fe540069752367d152898edf26511de7af8cb (diff) | |
| download | conky-theme-udt-403c76a77ff66dac9f84fa9a49d415a8e2442cee.tar.gz conky-theme-udt-403c76a77ff66dac9f84fa9a49d415a8e2442cee.zip | |
feat(hourly): thermometer and clock legends beside their rows
The raindrop's gutter now holds a legend for each labelled row: a
thermometer for the temperatures, the raindrop for rain chance, a clock
for the hours, each in its row's colour. The gutter is as wide as the
widest of the three. The condition-glyph row is icons already and gets
none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | lib/weather.lua | 2 | ||||
| -rw-r--r-- | widgets/hourly.lua | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/weather.lua b/lib/weather.lua index 28b3341..cd264d7 100644 --- a/lib/weather.lua +++ b/lib/weather.lua @@ -36,6 +36,8 @@ M.ICON = { overcast = '\u{E312}', unknown = '\u{E374}', raindrop = '\u{E371}', + thermometer = '\u{E350}', + clock = '\u{E38A}', } -- WMO weather code to glyph. The codes are sparse groups, not ranges, so a diff --git a/widgets/hourly.lua b/widgets/hourly.lua index 31a425b..c523b83 100644 --- a/widgets/hourly.lua +++ b/widgets/hourly.lua @@ -15,10 +15,13 @@ local function draw_curve(cr, x, y, w, h, colors, hours, S) local n = math.min(#hours, 24) local label = math.max(9, math.min(h * 0.135, w / 8 * 0.22, S * 0.32)) local glyph = label * 1.5 - -- A gutter on the left for the raindrop that labels the rain-chance row. - -- The whole band shifts, so the hour columns stay aligned with each other. + -- A gutter on the left for the legend glyphs that label the temperature, + -- rain-chance and hour rows. The whole band shifts, so the hour columns stay + -- aligned with each other. + local I = weather.ICON card.font(cr, card.FONT_MONO, label, false) - local gutter = card.advance(cr, weather.ICON.raindrop .. ' ') + local gutter = math.max(card.advance(cr, I.raindrop), card.advance(cr, I.thermometer), + card.advance(cr, I.clock)) + card.advance(cr, ' ') local x0 = x x, w = x + gutter, w - gutter local slot = w / n @@ -50,7 +53,7 @@ local function draw_curve(cr, x, y, w, h, colors, hours, S) end end cairo_fill(cr) - card.text(cr, x0, base - label * 0.1, weather.ICON.raindrop) + card.text(cr, x0, base - label * 0.1, I.raindrop) card.rgba(cr, colors.rule, 0.6) cairo_set_line_width(cr, 1) @@ -74,6 +77,12 @@ local function draw_curve(cr, x, y, w, h, colors, hours, S) end cairo_stroke(cr) + card.font(cr, card.FONT_MONO, label, false) + card.rgba(cr, colors.value) + card.text(cr, x0, y + glyph + label * 1.3, I.thermometer) + card.rgba(cr, colors.label) + card.text(cr, x0, y + h - label * 0.2, I.clock) + for i = 1, n, 3 do local hr = hours[i] card.font(cr, card.FONT_MONO, glyph, false) |
