aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
9 daysperf(dashboard): draw at 0.1s only while the dashboard is visibleDanilo M.1-0/+20
Conky gives Lua no way to request one redraw, so a scroll showed up to 2s late. Pointer enter and leave, which Hyprland sends on every toggle of the special workspace, now switch conky_set_update_interval between 0.1s and the config's 2s. At that rate the CPU and network counters would sample over 0.1s windows and the chart would fill 20x faster, so both now sample through data.new_gate on the /proc/uptime clock, about every 2s, and redraw their last values in between. The samplers move to texeci: execi runs in the main loop and a 0.7s nvtable or an Immich download stalled the scroll. Measured: about 12% of one core while visible, 0.5% while hidden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysfeat: add an updates card showing nvtable's package tableDanilo M.2-0/+40
Moves the nvchecker/nvtable table the login shell printed onto the dashboard, as a wide card at the bottom centre. bin/updates-sample.sh caches `nvtable -C -E` every ten minutes and starts nvchecker, fully detached, at most every 30 minutes. The widget parses the cache and colours it in the board's language: installed behind upstream is critical, a shipped .info behind is a warning, with nvtable's status dots per row and a legend on the bottom line. The mouse wheel scrolls rows that do not fit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysfeat(immich): fall back to the past week's memoriesDanilo M.1-1/+4
A day with no memories left the card showing only a notice. When today has none, immich-fetch.sh now merges the memories of each of the past six days, skipping a day whose request fails, and marks the index with a scope week line. The subtitle names where the photos come from, Today or This week, before the i/n counter, and the empty notice reads no memories this week. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysfeat: add an Immich memories card with click and scrollDanilo M.2-0/+38
A centred card showing today's "N years ago" photos from Immich, one at a time on a 30-second rotation, with when each was taken and where. bin/immich-fetch.sh runs from conky's execi every 30 minutes: it asks /api/memories for today, converts each preview to PNG (Cairo loads nothing else) and writes an index with the year, local capture time and place. The place needs the key's asset.read permission and reads '--' without it. The key lives in ~/.config/udt/immich.env, like the weather key, because a GPG-backed store would raise a pinentry unattended. The dashboard now registers lua_mouse_hook and hands pointer events to the widget under the pointer. On this card, scrolling steps through the photos and a left click opens the photo in Immich's web UI and hides the dashboard so the browser is not stuck beneath it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-18feat: add a title icon to every labelled cardDanilo M.1-0/+34
Add card.ICON and a card.title helper that draws the glyph in the highlight colour before the label, at the label's own size. The eight labelled cards use it, in both the fit_unit width measurement and the draw, so the icon cannot overrun a narrow cell. Clock (no label) and weather (condition glyph already) are unchanged, and the no-data notice titles stay text-only. Codepoints were chosen against a rendered contact sheet, not fontconfig alone, since a wrong codepoint draws a plausible neighbour.
2026-09-18refactor: unify card no-data face and fluid sizingDanilo M.1-4/+24
Extract card.notice so every cached card's no-data state is one fluid, theme-consistent face instead of a copy per widget, and delete the fixed-size card.label it replaces. Derive weather's arc geometry from its band (pad, curve room, sun dot, time labels) instead of fixed pixels, and cap the arc at a proportion of the card's width rather than 240px. Derive disks' bar-fallback height and its address type from the card's own label scale. Standardise the big-value factor to 1.0 across the fit_unit cards and document the big-value colour rule and the disks headline exception.
2026-09-18feat: add a breaktimer cardDanilo M.1-0/+73
Replaces the Waybar module that used to show breaktimer.sh with a card on the dashboard. The card's big value is the phase countdown, coloured by phase with the same language the Waybar module used, and two rows name the phase and what the countdown leads to. Data comes from bin/breaktimer-sample.sh, run by conky at execi 5, which reads the daemon's runtime files into a cache. The sampler owns the kill -0 liveness check, because conky's Lua cannot run a process and a dead daemon must read as 'fermo' rather than a stale 'running'. Drops outside the work-hours window freeze the countdown while the phase stays 'working'. The sampler detects this from the remain file's age and the card reads it as 'outside working hours', which also covers a hung daemon. The phase words and colour roles live in data.breaktimer_parse so they are unit-tested; the card only draws the result.
2026-09-18feat: add a calendar card reading khalDanilo M.1-0/+115
The month grid with the week's appointments below it, colour-coded by calendar. Events come from a cache file rather than a live call: khal costs about 200ms of Python startup, which is two orders of magnitude over the 2-second draw budget, so bin/calendar-sample.sh writes the cache on a 5-minute execi and the widget only parses. Calendar colours are read out of khal's own config by the sampler and mapped onto the board's palette roles, so the card follows a scheme change instead of pinning three literal hues. khal will not emit an ISO date: {start-date} uses the user's dateformat, which carries no year here, and a strftime spec inside the field raises. The sampler asks for {start-date-long} and data.calendar_date recovers the numbers by position, resolving day/month by magnitude and reading a genuinely ambiguous pair day-first. A 2-digit year is refused rather than guessed at. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add the network cardDanilo M.1-0/+25
Two lines on one chart against a shared ceiling, one sample per pixel column so nothing is interpolated. The history is module state sized from the card's width, so moving the card reframes the window rather than clearing it. The public address is refused once stale: an address that may no longer be yours, displayed with confidence, is worse than a dash. The fixture uses TEST-NET-1. This repository is public. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: read the available column from dfDanilo M.1-1/+6
Free space is read rather than derived: size - used overstates it by the root-reserved blocks, tens of gigabytes on a large filesystem, none of it available to anyone but root. Also asserts fs[3], the row whose device name ends in a digit. It sits next to a numeric column and is the row most likely to break a parser counting fields, and nothing covered it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17fix: strip the clock from every Intel form, not just the fixture'sDanilo M.1-1/+12
The pattern required a literal CPU token immediately before the @, which the one Intel fixture happens to carry. A Xeon reads 'E5-2680 v4 @ 2.40GHz' and a Tiger Lake 'i7-1165G7 @ 2.80GHz', so both kept their clock on the card. A generation prefix hid the vendor word from its anchor for the same reason: '11th Gen Intel Core i7-1165G7' kept 'Intel'. Three more forms added as tests. The Intel fixture was meant to keep the stripping a rule, and one fixture was not enough to do it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: parse the CPU and motherboard model stringsDanilo M.1-0/+65
Stripping by rule rather than by a table of known parts: a leading vendor word, trademark noise, a trailing core count or clock. The Intel fixture exists to keep it a rule. DMI placeholders read as no board at all. 'To Be Filled By O.E.M.' on the dashboard is worse than a blank row. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: parse the sampler's key/value cache formatDanilo M.1-0/+18
Only the first space separates, so a value keeps its own spaces. Values stay strings: the sampler writes epochs and the widget decides whether an age reads as hours or days. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-17feat: add a byte-rate counter for interface statisticsDanilo M.1-0/+37
Mirrors new_cpu_counter: cumulative counters need two samples to yield a rate, and each direction carries its own previous reading. Clamps a negative delta to zero rather than letting a 32-bit wrap or an interface reset produce a spike. One bogus sample sets the shared autoscale and flattens the entire window. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-17feat: add card.plot, a shared-scale line chartDanilo M.1-0/+54
Several series on one baseline and one ceiling. The shared ceiling is the point: scaled independently, a 200kB/s upload draws the same height as a 40MB/s download, which is a lie about a link's shape. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17fix: restore the line width card.ring sets, add card.truncateDanilo M.1-2/+26
A ring left its line width behind, so the next stroke on the card inherited a hairline several pixels thick. It already restored the cap for the same reason. card.truncate replaces byte slicing, which cuts a multi-byte character in half and emits an invalid sequence Cairo draws as a box. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: fluid type for the gpu and cache cardsDanilo M.1-0/+28
The big value moves to the right of the heading, on the same baseline, so the card's width carries it instead of leaving the right half empty. Type now scales to fill the cell: card.fit_unit measures the rows and returns the largest size that fits the width, and the widget takes the smaller of that and its height budget, shrinking only where a row would collide.
2026-09-17fix: stop the widgets from stalling or raising the drawDanilo M.2-8/+22
Memoize hwmon_dir by chip name so sensor reads no longer popen grep on every frame, cache misses included. Floor fractional byte counts in card.human so it cannot raise. Drop the GPU package-temperature row, which duplicated the headline. Set umask before mkdir in both samplers so a fresh cache directory is not world-readable. Make render.lua exit non-zero on a draw error and tolerate an unset HOME.
2026-09-17feat: add the disks and cache cardsDanilo M.1-0/+4
disks draws a ring per filesystem from the df sample, with the NFS server address read from the device field and a labelled-bar fallback when the rings would be too small to read. cache shows the ~/.cache total and its four largest children from the du sample. card.ring now resets the cairo path first: a preceding card.text() leaves a current point, and cairo_arc() joins to it with a straight line, so the disks rings were drawn with stray chords. The ring primitive had no caller until now, which is why it went unnoticed.
2026-09-17feat: add bar, vbar, ring and threshold primitivesDanilo M.1-0/+91
2026-09-17feat: parse df and du output for the disk and cache cardsDanilo M.1-0/+76
2026-09-17feat: add per-core CPU times and named sensor readsDanilo M.1-0/+53
2026-09-17feat: give the clock its own fontDanilo M.1-0/+12
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-17fix: guard now, and clamp a negative age, in the staleness pairDanilo M.1-2/+12
is_stale and age_str were the only functions in the module doing arithmetic on an unchecked argument: a nil `now` raised, and a raise in this project is a blank dashboard with no message. Every caller passes os.time(), which cannot be nil, so this was unreachable, but it is the same bug already fixed once in icon() and the module header promises nothing raises. age_str also printed a negative age when the observation timestamp was in the future, which a clock skew can produce. "stale -17m" on the card reads as a broken widget, so the age now floors at zero and such a reading counts as fresh: weather from the future is not old. With this the whole module is raise-free, verified across every function against nil, string, table, boolean, NaN, negative and zero arguments in all three positions. Both cases were found by the Task 5 implementer, which was asked to probe beyond its given tests and reported them without changing the code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add cache staleness classificationDanilo M.1-0/+17
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17fix: do not truncate a number in exponent formDanilo M.1-3/+6
The numeric patterns stopped at the 'e', so a temp of 1.8e1 parsed as 1.8 and the card would have drawn 2 degrees instead of 18. Wrong in the worst way available: silently, and still looking like weather. OWM has not been seen to emit exponent form, and sampling several cities near and below zero returned plain decimals throughout, so this was not reachable in practice. Fixed regardless, because two characters in a character class is cheaper than the reasoning required to be sure it stays unreachable, and unlike the NaN case noted in sun_t this one fails invisibly rather than leaving a mark. Tests now cover both a negative temperature, which is ordinary here for half the year, and the exponent form. Reverting the pattern fails them. Found by adversarial probing of the committed parser, not by the plan's own tests, which only exercise the fixture. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: parse the cached OWM responseDanilo M.1-0/+41
Lua patterns instead of a JSON library: the current-weather response is flat and known, so six scalars do not justify a dependency. Every failure path (truncated write, empty file, garbage, an API error body, nil input) returns nil rather than raising, since a Lua error here is a blank dashboard. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17docs: note that sun_t passes a NaN timestamp throughDanilo M.1-0/+5
NaN is a number, so the type guard admits it, and every comparison against NaN is false, so neither clamp catches it and the function returns NaN. Left unguarded on purpose. No caller can produce it: parse() matches %d+ for the sun times and `now` is os.time(). If one ever did, Cairo ignores a NaN coordinate, so the arc would lose its dot rather than the dashboard going blank. A ponytail: comment names the ceiling and where the guard would go. Found while probing the committed code, not by the tests, which do not cover NaN. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add sun position along the daylight arcDanilo M.1-0/+24
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17docs: explain the Beaufort index arithmetic and why compass existsDanilo M.1-0/+9
Two comments, no behaviour change. `force - 1` reads as an off-by-one until you know the scale starts at 0 while ipairs starts at 1, so the loop index is already force + 1. Said plainly now, along with why the fall-through returns 12. compass() has no caller: the card draws arrow(). It is kept because it shares arrow()'s binning exactly, so testing both pins that shared logic from two angles, and switching the card to "S 9 km/h" becomes a one-word change. Without this note the next reader finds an unused function and has to reconstruct the reasoning. Raised by code review as the only two points worth acting on; no Critical or Important issues were found. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add wind conversion, Beaufort and compass tablesDanilo M.1-0/+41
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17fix: guard a nil timestamp in the icon lookupDanilo M.1-1/+5
icon(800, nil, 1500, 1900) compared nil against a number and raised, which in this project is a blank dashboard with no message. The module's own header promises nothing raises, and is_day() already guards the same case, so the inconsistency was the bug. Not reachable from the widget as written: it passes os.time(), and parse() refuses a response without sunrise and sunset, so no caller can currently produce the failing combination. Fixed anyway, because the contract is what future callers will rely on and the fix is one word. The test file also now says why the codepoint VALUES carry no assertion: comparing M.ICON.snow against a literal would only prove the escape was typed twice. Whether E31A draws a snow cloud is what the glyph sheet is for, and mutation testing confirms the assertions cannot see it. Found by code review. The same fix is applied to the plan, so Tasks 2-5 inherit the guarded version. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17feat: add OWM condition id to icon mappingDanilo M.1-0/+62
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16fix: step text cursors by advance, not ink widthDanilo M.1-0/+15
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-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>
2026-09-16feat: add stateful CPU percentage counterDanilo M.1-0/+27
Load is a delta, so one reading cannot yield a percentage. The first call returns nil rather than a fabricated number: 100% on startup reads as a real spike. A non-advancing counter also returns nil instead of dividing by zero, and the result is clamped because a suspend/resume can produce a nonsense delta. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16feat: add /proc and /sys parsers with fixture testsDanilo M.1-0/+75
Parsers take file contents as a string, not a path, so they test against committed fixtures with no filesystem mocking. hwmon is globbed by its name file rather than a fixed index, carried over from the old config: indices drift across kernel reorders and a stale one silently reads a different chip. Failure returns nil, never 0. A sensor reading 0 C is legitimate, so 0 cannot double as an error value. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>