aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-17 09:34:13 +0200
committerDanilo M. <danix@danix.xyz>2026-09-17 09:34:13 +0200
commit5a4c0c0de6cb5ed544773a9aa056ac2b3e5b486b (patch)
treefcbb07f6de09a6d297e8ac78410fddd59b6544b0
parentb51d1efa913933cb272b7c1906340981f00010c8 (diff)
downloadconky-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>
-rw-r--r--dashboard.lua10
-rw-r--r--widgets/weather.lua28
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