diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-17 09:34:13 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-17 09:34:13 +0200 |
| commit | 5a4c0c0de6cb5ed544773a9aa056ac2b3e5b486b (patch) | |
| tree | fcbb07f6de09a6d297e8ac78410fddd59b6544b0 /widgets | |
| parent | b51d1efa913933cb272b7c1906340981f00010c8 (diff) | |
| download | conky-theme-udt-5a4c0c0de6cb5ed544773a9aa056ac2b3e5b486b.tar.gz conky-theme-udt-5a4c0c0de6cb5ed544773a9aa056ac2b3e5b486b.zip | |
feat: move to an 8x6 grid, and let the weather card fit any cell height
The grid was 4x2, which made every placement decision a coarse one. 8x6
gives 299x157 cells, so a card can be sized in something closer to the
increments the layout actually wants. Nothing in rect_for needed
changing: it derives cell size from COLS and ROWS, so this is a
two-number edit.
Note that ROWS has to cover the tallest row in use. A widget placed on
row 3 of a two-row grid is computed at y=1068 on a 1080px screen and
draws off the bottom, silently.
The arc band no longer has a minimum height. It had one, and in a cell
40px shorter than the content wanted, the minimum won and pulled the
curve up through the stat rows, drawing the sunrise time across the word
WIND. It now takes what is genuinely left and is skipped below the
height where it could be read, so the same widget composes in a 2x2 or a
2x3 cell without overlapping anything. Checked by rendering the widget
offscreen at 2x1, 2x2 and 2x3 before restarting conky.
Layout is now a 1x3 clock with a 2x3 weather card beneath it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'widgets')
| -rw-r--r-- | widgets/weather.lua | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/widgets/weather.lua b/widgets/weather.lua index 4882a4c..50d0e10 100644 --- a/widgets/weather.lua +++ b/widgets/weather.lua @@ -185,24 +185,18 @@ function M.draw(cr, rect, colors) sy = sy + row_step end - -- The arc follows the stats rather than being pinned to the bottom, and - -- takes the smaller of its natural height and whatever remains. Pinning it - -- low left a dead band between the stats and the curve; the layout gives - -- this widget a cell sized to its content, so the drawing should end where - -- the content does. + -- The arc takes what is genuinely left below the stats, with no minimum: a + -- floor here meant a short cell pulled the curve up THROUGH the stat rows, + -- drawing the sunrise time over the word WIND. Below the height where it + -- can be read it is dropped entirely, because no arc beats a broken one. + -- This is what lets one widget sit in a 2x2 or a 2x3 cell unchanged. local bottom = inner.y + inner.h - 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 - -- the arc band's top edge, and the gap left by a tall card falls here. - local ry2 = arc_y - 14 - card.rgba(cr, colors.rule, 0.8) - cairo_move_to(cr, inner.x, ry2) - cairo_line_to(cr, inner.x + inner.w, ry2) - cairo_stroke(cr) - - draw_arc(cr, inner.x, arc_y, inner.w, arc_h, colors, w, now) + local arc_y = sy + row_step * 0.6 + local arc_h = math.min(bottom - arc_y, inner.h * 0.34, 240) + if arc_h >= 70 then + draw_arc(cr, inner.x, arc_y, inner.w, arc_h, colors, w, now) + end end + return M |
