diff options
| -rw-r--r-- | dashboard.lua | 10 | ||||
| -rw-r--r-- | widgets/weather.lua | 28 |
2 files changed, 15 insertions, 23 deletions
diff --git a/dashboard.lua b/dashboard.lua index c0e06c3..f5c068e 100644 --- a/dashboard.lua +++ b/dashboard.lua @@ -16,14 +16,12 @@ local card = require 'lib.card' -- Order and position are yours: edit this table, nothing else. -- col/row are grid cells, w/h span cells. Cell size is derived from the -- surface, so the same table works on a 2560x1080 and a 1920x1080 screen. -local COLS, ROWS = 4, 2 +local COLS, ROWS = 8, 6 local layout = { - { 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 }, + { widget = 'clock', col = 1, row = 1, w = 1, h = 3 }, + -- Under the clock, same column. + { widget = 'weather', col = 1, row = 4, w = 2, h = 3 }, } -- ========================================================================== 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 |
