aboutsummaryrefslogtreecommitdiffstats
path: root/lib/card.lua
AgeCommit message (Collapse)AuthorFilesLines
2026-09-16fix: read the palette from the config file, and stop leaking extentsDanilo M.1-3/+16
Two defects, both found by review of the Cairo work and both confirmed by experiment rather than reasoning. The palette mechanism could not have worked. conky_parse('${color3}') returns an empty string: conky's colour variables emit renderer escape codes into conky.text, they never evaluate to a hex string, and ${default_shade_color} is not a variable at all, so conky_parse hands the literal text back. conky.config is not exposed to Lua either (_G.conky is nil) and conky_info carries only cpu_count and update_interval. What Lua does get is conky_config, the config file's path, so the colours are now parsed out of that file, where UDT has already substituted real hex. The pattern needs [%w_]+ rather than %w+ or it misses default_color and default_shade_color. The card fill also duplicated the border colour, both being color3, so filling at 0.55 alpha and stroking the hairline at 0.9 in one hue made the border invisible and the cards read as blobs rather than the mockup's thin outlines. The fill is default_shade_color now, a role every scheme already defines. card.measure allocated a cairo_text_extents_t per call, which leaks: 5000 allocations grow Lua's heap by 182KB that GC never reclaims, and :destroy() on each does not help, measured at the same 182KB. One reused module-level struct costs 0KB. A draw hook running every 2s would have bled memory for as long as conky stayed up, which no screenshot would ever reveal. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16feat: add Cairo card primitivesDanilo M.1-0/+86
Rounded-rect card with a hairline border, text helpers with measured alignment, and font selection. Cairo's font API stops at BOLD, so the Black face is reached by family name instead of weight: at size 90, '13' measures 100px as Noto Sans Black against 94px as Bold, confirming the heavier face is selected. The card radius is clamped to half the shorter side, because a larger radius makes the corner arcs overlap into a bowtie. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>