diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-17 09:20:22 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-17 09:20:22 +0200 |
| commit | a3bb9e2764b415901fb2475c03f6fdb8a736d4fa (patch) | |
| tree | 8ba41f20eefce6eb9c983d7276041f194d716f4c /widgets | |
| parent | af64aed9b49c727d6b4050f3534115cead314f1d (diff) | |
| download | conky-theme-udt-a3bb9e2764b415901fb2475c03f6fdb8a736d4fa.tar.gz conky-theme-udt-a3bb9e2764b415901fb2475c03f6fdb8a736d4fa.zip | |
feat: put the weather card under the clock, scale its type to width
Placement is column 1 row 2, directly beneath the clock, which drops to
a single-row cell to make room.
The card's type now scales off the cell WIDTH rather than its height.
Scaling off height meant the text shrank every time the cell got
shorter, and beside the clock's numerals the card read as a whisper.
Width is the stable dimension for this layout and is what constrains the
text anyway, since the stat rows run edge to edge.
Verified against the live dashboard, not only the offscreen render: the
two disagreed about type size precisely because the offscreen harness
was cropped to the card and never showed it next to the clock.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'widgets')
| -rw-r--r-- | widgets/weather.lua | 19 |
1 files changed, 12 insertions, 7 deletions
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 |
