diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-18 15:07:55 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-18 15:07:55 +0200 |
| commit | 734c2ac8383bc6afe45796b416cb7c70a090d569 (patch) | |
| tree | f8013723964ed82157dc5d1797acbb3fd5683dd1 | |
| parent | 9001b61dd3d48b7dedff40810cf258cbc3b41fee (diff) | |
| download | conky-theme-udt-734c2ac8383bc6afe45796b416cb7c70a090d569.tar.gz conky-theme-udt-734c2ac8383bc6afe45796b416cb7c70a090d569.zip | |
feat(now): the condition glyph stands in for the title, large
card.standard() without a title draws the icon alone at the big value's
size, the glyph-for-title case DESIGN.md already allows. The now card
uses it and drops the bottom glyph.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md | 2 | ||||
| -rw-r--r-- | lib/card.lua | 19 | ||||
| -rw-r--r-- | widgets/now.lua | 16 |
3 files changed, 18 insertions, 19 deletions
diff --git a/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md b/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md index 3d8b049..cfa344e 100644 --- a/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md +++ b/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md @@ -48,7 +48,7 @@ only what DESIGN.md calls a card's variable band. | Card | Header left | Big value (top-right) | Rows | Variable band | |---|---|---|---|---| -| `now` | condition glyph | current temperature, `body` | feels like, high / low, rain chance, last update | the condition glyph, large, in the leftover height | +| `now` | condition glyph at big-value size, standing in for the title | current temperature, `body` | feels like, high / low, rain chance, last update | none | | `hourly` | glyph + "Next 24h" | next hour's temperature, `body` | none | temperature curve over 24 hours; every 3rd hour labelled with glyph and temperature; rain-chance bars under the curve in `value`, half alpha, with a minimum height so a low chance still shows | | `week` | glyph + "Week" | none (band carries the value) | one per day: day name, glyph, min, range bar, max | the range bar in each row, positioned on the week's overall min..max scale | | `details` | glyph + "Details" | none | wind (speed + compass point), humidity, UV, AQI | a small wind compass with a needle at the wind direction | diff --git a/lib/card.lua b/lib/card.lua index 6729b31..34c1c0b 100644 --- a/lib/card.lua +++ b/lib/card.lua @@ -320,7 +320,8 @@ end -- The DESIGN.md card in one call: the title top-left, the big value top-right, -- then label-left / value-right rows, all from one fluid base size S. -- --- spec.icon, spec.title the title run, as M.title draws it +-- spec.icon, spec.title the title run, as M.title draws it; no title draws +-- the icon alone at the big value's size -- spec.big the big value; nil drops it (a band carries the value) -- spec.big_color defaults to colors.body -- spec.big_font defaults to FONT_HEAVY; FONT_MONO for a glyph @@ -335,7 +336,9 @@ function M.standard(cr, inner, colors, spec) local rows = spec.rows or {} local big = spec.big and tostring(spec.big) local big_font = spec.big_font or M.FONT_HEAVY - local head = { { M.title_str(spec.icon, spec.title), M.FONT_MONO, LABEL_F } } + -- No title: the icon stands in for it at the big value's size (DESIGN.md). + local head = { spec.title and { M.title_str(spec.icon, spec.title), M.FONT_MONO, LABEL_F } + or { spec.icon, M.FONT_MONO, BIG_F } } if big then head[2] = { big, big_font, BIG_F } end local groups = { head } for _, r in ipairs(rows) do @@ -343,7 +346,7 @@ function M.standard(cr, inner, colors, spec) { r[2] == nil and '--' or tostring(r[2]), M.FONT_MONO, ROW_F } } end -- Height in units of S: the header line, the gap under it, a step per row. - local head_f = big and BIG_F or LABEL_F * 1.2 + local head_f = (big or not spec.title) and BIG_F or LABEL_F * 1.2 local budget = inner.h * (spec.share or 1) local S = clamp(math.min(budget * 0.94 / (head_f + 0.5 + #rows * 0.66), M.fit_unit(cr, inner.w * 0.96, groups, 100)), 10, 72) @@ -354,8 +357,14 @@ function M.standard(cr, inner, colors, spec) M.rgba(cr, spec.big_color or colors.body) M.text_right(cr, inner.x + inner.w, inner.y + S * BIG_F, big) end - M.font(cr, M.FONT_MONO, label_size, false) - M.title(cr, inner.x, inner.y + label_size, spec.icon, spec.title, colors) + if spec.title then + M.font(cr, M.FONT_MONO, label_size, false) + M.title(cr, inner.x, inner.y + label_size, spec.icon, spec.title, colors) + else + M.font(cr, M.FONT_MONO, S * BIG_F, false) + M.rgba(cr, colors.highlight) + M.text(cr, inner.x, inner.y + S * BIG_F, spec.icon) + end local step = row_size * 2.0 local y = inner.y + S * head_f + row_size * 1.6 diff --git a/widgets/now.lua b/widgets/now.lua index f00c46e..03a9ecc 100644 --- a/widgets/now.lua +++ b/widgets/now.lua @@ -26,21 +26,11 @@ function M.draw(cr, rect, colors) { 'UPDATED', weather.age_str(c.dt, now), weather.is_stale(c.dt, now) and colors.warning or nil }, } - local y, S = card.standard(cr, inner, colors, { - icon = weather.icon(c.code, c.is_day), title = 'WEATHER', + -- No title: the condition glyph stands in for it, at the big value's size. + card.standard(cr, inner, colors, { + icon = weather.icon(c.code, c.is_day), big = weather.deg(c.temp), rows = rows, share = 0.85, }) - - -- The condition as a large glyph, the card's variable band: the type is - -- capped to match the other cards, so a tall cell leaves height over, and the - -- glyph takes it. Dropped when there is no room for one bigger than a row. - local size = math.min(inner.y + inner.h - y, inner.w * 0.45) - if size > S * 0.6 then - card.font(cr, card.FONT_MONO, size, false) - card.rgba(cr, colors.highlight) - card.text_centre(cr, inner.x + inner.w / 2, inner.y + inner.h - size * 0.15, - weather.icon(c.code, c.is_day)) - end end return M |
