aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-17 09:38:12 +0200
committerDanilo M. <danix@danix.xyz>2026-09-17 09:38:12 +0200
commit4985439eb2feb15757c3c8056cbeb5ae2abe1442 (patch)
tree77bc603b39eef6feafc045bfa5237d49dffb3fd3 /README.md
parent5a4c0c0de6cb5ed544773a9aa056ac2b3e5b486b (diff)
downloadconky-theme-udt-4985439eb2feb15757c3c8056cbeb5ae2abe1442.tar.gz
conky-theme-udt-4985439eb2feb15757c3c8056cbeb5ae2abe1442.zip
feat: make the clock fill whatever cell it is given
The numerals scaled off the cell but the date block sat at a fixed drop below them, so a tall cell left a dead band under the date and a short one would have collided. Now the date pins to the bottom edge, the numerals take everything above it, and both type sizes derive from the width, so the slack of a tall cell falls in the middle of the card where it belongs. Type scales off width for the same reason the weather card does: height is what changes when a row is added to the grid, and a widget that shrinks its text whenever its cell gets shorter reads as broken next to its neighbours. Checked at 1x3, 1x6, 2x2, 2x4 and 3x3 on an 8x6 grid before restarting conky. The 1x6 case stays width-bound and leaves room below the numerals, which is correct for a cell far taller than it is wide. The README now states the convention, since it applies to every widget added later: derive offsets from the rect, scale off width, decide where the slack goes, and drop an element that would otherwise overlap. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/README.md b/README.md
index 912aa18..b51e9fa 100644
--- a/README.md
+++ b/README.md
@@ -100,6 +100,33 @@ bug here: ink width ignores leading and trailing spaces, so `' / '` measures 6px
of ink against a 14px advance, and stepping a cursor by the ink width renders
the date as `16 /SEP /2026`.
+### Widgets are fluid
+
+A widget is handed a rectangle and must fill it, whatever shape the grid makes
+it. That is what lets you retune `COLS`/`ROWS` or move a card without touching
+widget code. Three rules, all learned by getting them wrong:
+
+**Derive every size and offset from the rect.** No fixed pixel drops between
+elements. A fixed `+34` under a numeral that scales leaves a dead band in a tall
+cell and overlaps in a short one.
+
+**Scale type off the WIDTH, not the height.** Height is what changes when you
+add a row to the grid, and a card that shrinks its text every time its cell gets
+shorter reads as broken beside its neighbours. Width is also usually what
+constrains the text, since rows run edge to edge. Clamp it: `math.max(lo,
+math.min(hi, inner.w * k))`.
+
+**Decide where the slack goes, and let one element absorb it.** The clock pins
+its date block to the bottom and gives the numerals everything above. The
+weather card stacks from the top and lets the arc take the remainder. Either is
+fine; what fails is leaving the slack wherever it lands.
+
+An element that cannot shrink below some size should drop out rather than
+overlap. The weather arc does this: below 70px it is not drawn at all, because a
+curve crossing the stat rows is worse than no curve. Check a widget at several
+spans before believing it is fluid, which the offscreen renderer above makes
+cheap.
+
## Development
Run it in the foreground to see Lua output, which is the only debugging channel: