diff options
| -rw-r--r-- | dashboard.lua | 10 | ||||
| -rw-r--r-- | docs/superpowers/plans/2026-09-17-weather-widget.md | 8 | ||||
| -rw-r--r-- | widgets/weather.lua | 19 |
3 files changed, 21 insertions, 16 deletions
diff --git a/dashboard.lua b/dashboard.lua index f5e74f3..c0e06c3 100644 --- a/dashboard.lua +++ b/dashboard.lua @@ -19,11 +19,11 @@ local card = require 'lib.card' local COLS, ROWS = 4, 2 local layout = { - { widget = 'clock', col = 1, row = 1, w = 1, h = 2 }, - -- 1x1, not 1x2: the card's content is about 350px tall, so a full-height - -- cell left a dead band down its middle. A single-row cell is as tall as - -- what it holds. - { widget = 'weather', col = 2, row = 1, w = 1, h = 1 }, + { widget = 'clock', col = 1, row = 1, w = 1, h = 1 }, + -- Under the clock, same column. 1x1 rather than a full-height cell: the + -- card's content is about 350px tall and a taller cell left a dead band + -- down its middle. + { widget = 'weather', col = 1, row = 2, w = 1, h = 1 }, } -- ========================================================================== diff --git a/docs/superpowers/plans/2026-09-17-weather-widget.md b/docs/superpowers/plans/2026-09-17-weather-widget.md index 14bf11f..3288c8f 100644 --- a/docs/superpowers/plans/2026-09-17-weather-widget.md +++ b/docs/superpowers/plans/2026-09-17-weather-widget.md @@ -1065,10 +1065,10 @@ In `dashboard.lua`, replace the `layout` table: ```lua local layout = { { widget = 'clock', col = 1, row = 1, w = 1, h = 2 }, - -- 1x1, not 1x2: the card's content is about 350px tall, so a full-height - -- cell left a dead band down its middle. A single-row cell is as tall as - -- what it holds. - { widget = 'weather', col = 2, row = 1, w = 1, h = 1 }, + -- Under the clock, same column. 1x1 rather than a full-height cell: the + -- card's content is about 350px tall and a taller cell left a dead band + -- down its middle. + { widget = 'weather', col = 1, row = 2, w = 1, h = 1 }, } ``` diff --git a/widgets/weather.lua b/widgets/weather.lua index 9431b0c..4882a4c 100644 --- a/widgets/weather.lua +++ b/widgets/weather.lua @@ -116,13 +116,18 @@ function M.draw(cr, rect, colors) -- Type sizes scale with the card, within limits that keep them legible on a -- small cell and stop them ballooning on a tall one. + -- Sizes scale off the WIDTH, not the height: the widget sits in a 1x1 cell + -- whose height changes with the grid, and scaling off height made the type + -- shrink to a whisper beside the clock's numerals when the cell got shorter. + -- Width is the stable dimension here, and it is what constrains the text + -- 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.h * 0.075, 34, 60) - local glyph_size = clamp(temp_size * 0.80, 26, 46) - local label_size = clamp(inner.h * 0.014, 10, 14) - local desc_size = clamp(inner.h * 0.017, 12, 17) - local row_size = clamp(inner.h * 0.016, 11, 15) - local row_step = row_size * 1.9 + local temp_size = clamp(inner.w * 0.135, 40, 84) + local glyph_size = clamp(temp_size * 0.74, 30, 60) + 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: condition glyph, then the temperature with the city beneath it. local glyph = weather.icon(w.id, now, w.sunrise, w.sunset) @@ -186,7 +191,7 @@ function M.draw(cr, rect, colors) -- this widget a cell sized to its content, so the drawing should end where -- the content does. local bottom = inner.y + inner.h - local arc_h = clamp(inner.h * 0.30, 90, 190) + local arc_h = clamp(inner.h * 0.34, 110, 240) local arc_y = math.min(sy + row_step * 0.6, bottom - arc_h) -- Rule above the arc, riding with it rather than with the stats: it reads as |
