aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/clock.lua
AgeCommit message (Collapse)AuthorFilesLines
2026-09-17fix: close the gap between the clock numerals and the dateDanilo M.1-5/+23
The numeral size was capped at a flat 0.46 of the available height, which for two baselines spanning 1.70x the size meant they could only ever fill about four fifths of the band, leaving a void above the date. The divisor is now derived from the baselines themselves. The width cap is measured rather than guessed: two Oswald digits are 1.00x the font size wide (at size 100, '00' measures 100.0px and the widest pair '88' 98.0px), so a width w permits a size of about w, less a margin at the card edges. A narrow cell is still width-bound and cannot fill its height. That slack is now split above and below the numerals instead of collecting under them, so the pair sits centred in the space it cannot fill. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: centre the clock numeralsDanilo M.1-2/+9
Horizontally centred in the card; the weekday and date stay against the left edge at the bottom. Each line is centred on its own ink width via measure(), not advance(): ink is what centring wants, and Oswald is proportional, so 10 and 05 are not the same width and a shared measurement would leave one of them visibly off-centre. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: give the clock its own fontDanilo M.1-1/+1
Installs Oswald (OFL-1.1, from googlefonts/OswaldFont) under ~/.fonts/o/Oswald with its license, and points the clock numerals at it for the squared look the rounded Noto Sans Black did not have. Per-widget fonts needed no new machinery: card.font() already takes any family string, so FONT_* are shared defaults rather than a restriction. FONT_CLOCK joins them, and the weather card keeps FONT_HEAVY, so the two no longer have to agree. Cairo still cannot ask for a weight above bold, so a heavier cut is selected by family name as FONT_HEAVY already did. Worth knowing that fontconfig substitutes a default for a family it does not recognise, which is indistinguishable from the font not applying; fc-match tells you which happened. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: make the clock fill whatever cell it is givenDanilo M.1-10/+31
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>
2026-09-16fix: step text cursors by advance, not ink widthDanilo M.1-1/+2
The date rendered as "16 /SEP /2026", each slash jammed against the next glyph. measure() returns the ink width, which ignores leading and trailing spaces because a space carries no ink, and clock.lua was using it to advance a cursor. Measured: " / " covers 6px of ink but advances 14px, so every separator lost 8px. Splits the two uses that were conflated in one function. measure() is for centring and right-aligning, where ink width is what you want; advance() returns x_advance and is for laying out runs of text left to right. The clock's date now uses advance() and reads "16 / SEP / 2026" with even gaps, verified by screenshot. Worth the split rather than changing measure() in place: text_right is a correct caller of the ink width, so one function cannot serve both and silently returning the advance would have broken alignment instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16feat: add the clock widgetDanilo M.1-0/+56
Hour stacked over minute in Noto Sans Black, weekday in caps, date slashed, following idea2.png. Colours are the palette's. Numeral size derives from the cell rather than a constant, so the same widget fills its cell on either monitor. The slashes take the dimmer label colour so the numerals read first. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>