diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-29 13:33:14 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-29 13:33:14 +0200 |
| commit | 9624351d80ace747d3117fb22d6cbd00fce3eedf (patch) | |
| tree | f9adc0a04445718d2d2b5e1b659b00fb8373c73c /dashboard.lua | |
| parent | 272c5732b0bc932749f0e771de51ee49f6cebe5b (diff) | |
| download | conky-theme-udt-9624351d80ace747d3117fb22d6cbd00fce3eedf.tar.gz conky-theme-udt-9624351d80ace747d3117fb22d6cbd00fce3eedf.zip | |
feat: add an Immich memories card with click and scroll
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>
Diffstat (limited to 'dashboard.lua')
| -rw-r--r-- | dashboard.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/dashboard.lua b/dashboard.lua index 95b3f79..8a89a02 100644 --- a/dashboard.lua +++ b/dashboard.lua @@ -34,6 +34,9 @@ local layout = { -- arrangement for the board yet. { widget = 'network', col = 14, row = 9, w = 3, h = 3 }, { widget = 'slackware', col = 12, row = 10, w = 2, h = 3 }, + -- Centred on the board. Twice as many rows as columns because cells are + -- about twice as wide as tall, so this span comes out square. + { widget = 'immich', col = 7.25, row = 3.5, w = 3.5, h = 7 }, } -- ========================================================================== @@ -162,6 +165,29 @@ local function draw(cr, sw, sh, colors) end end +-- Pointer events, handed to the widget whose cell is under the pointer, if it +-- defines mouse(event, rect). Coordinates are window-relative, and the window +-- is the whole surface, so they index the same grid the draw uses. +-- +-- Wrapped like the draw: a fault here must not take conky down. Returning true +-- tells conky the event was consumed. +function conky_mouse(event) + if conky_window == nil then return false end + local sw, sh = conky_window.width, conky_window.height + for _, entry in ipairs(layout) do + local r = rect_for(entry, sw, sh) + if event.x >= r.x and event.x < r.x + r.w + and event.y >= r.y and event.y < r.y + r.h then + local w = widget(entry.widget) + if not (w and w.mouse) then return false end + local ok, res = pcall(w.mouse, event, r) + if not ok then print('dashboard: mouse in ' .. entry.widget .. ': ' .. tostring(res)) end + return ok and res == true + end + end + return false +end + function conky_main() if conky_window == nil then return end local s = conky_surface() |
