aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/immich.lua
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-29 14:12:31 +0200
committerDanilo M. <danix@danix.xyz>2026-09-29 14:12:31 +0200
commit4bc21dd416002acb679ad796f5ec4ae4a5d25238 (patch)
treebfdf761b182f4785b274de1eae2410df1b4ab313 /widgets/immich.lua
parent2da0114d10cc4cc679045a2c705ae8da4da7e51b (diff)
downloadconky-theme-udt-4bc21dd416002acb679ad796f5ec4ae4a5d25238.tar.gz
conky-theme-udt-4bc21dd416002acb679ad796f5ec4ae4a5d25238.zip
feat(immich): mark the big value with a Y ago unit
The years-ago count read as a bare number unless you read the subtitle. It now carries a small Y at its top-right, where a degree sign sits on a temperature, and ago under it on the baseline. The subtitle drops its now redundant "years ago" and keeps only the i/n counter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'widgets/immich.lua')
-rw-r--r--widgets/immich.lua23
1 files changed, 19 insertions, 4 deletions
diff --git a/widgets/immich.lua b/widgets/immich.lua
index 17e0b02..a9caca7 100644
--- a/widgets/immich.lua
+++ b/widgets/immich.lua
@@ -60,6 +60,7 @@ function M.draw(cr, rect, colors)
local inner = card.card(cr, rect, colors)
local function clamp(v, lo, hi) return math.max(lo, math.min(hi, v)) end
local LABEL_F, BIG_F, ROW_F, SUB_F = 0.30, 1.0, 0.32, 0.26
+ local UNIT_F, AGO_F = 0.40, 0.24 -- the "Y" beside the big value, "ago" under it
local photos = data.immich_parse(data.slurp(DIR .. 'index.txt') or '')
if not photos then
@@ -80,8 +81,7 @@ function M.draw(cr, rect, colors)
local ago = p.year and (tonumber(os.date('%Y')) - p.year) or nil
local big = ago and tostring(ago) or '--'
- local sub = (ago == 1 and 'year ago' or 'years ago')
- .. (n > 1 and string.format(' %d/%d', i, n) or '')
+ local sub = n > 1 and string.format('%d/%d', i, n) or ''
local t = p.taken
local taken = t and string.format('%02d/%02d/%04d %02d:%02d',
t[3], t[2], t[1], t[4], t[5]) or '--'
@@ -92,7 +92,7 @@ function M.draw(cr, rect, colors)
-- the whole card's type every time a long place name comes round.
local groups = {
{ { card.title_str(card.ICON.immich, 'MEMORIES'), card.FONT_MONO, LABEL_F },
- { big, card.FONT_HEAVY, BIG_F } },
+ { big, card.FONT_HEAVY, BIG_F }, { 'ago', card.FONT_UI, AGO_F } },
{ { sub, card.FONT_UI, SUB_F } },
{ { 'TAKEN ', card.FONT_MONO, ROW_F }, { taken, card.FONT_MONO, ROW_F } },
}
@@ -100,9 +100,24 @@ function M.draw(cr, rect, colors)
card.fit_unit(cr, inner.w * 0.96, groups, 100)), 10, 72)
local label_size, row_size = S * LABEL_F, S * ROW_F
+ -- The big value carries its unit the way a temperature carries its degree
+ -- sign: a small "Y" top-right of the digits, "ago" under it on the
+ -- baseline, both right-aligned in a column against the card edge.
+ local right, base = inner.x + inner.w, inner.y + S * BIG_F
+ card.font(cr, card.FONT_UI, S * AGO_F, false)
+ local col_w = card.measure(cr, 'ago')
+ card.rgba(cr, colors.label, 0.65)
+ card.text_right(cr, right, base, 'ago')
+ card.font(cr, card.FONT_HEAVY, S * UNIT_F, false)
+ local unit_w, unit_h = card.measure(cr, 'Y')
+ col_w = math.max(col_w, unit_w)
+
card.font(cr, card.FONT_HEAVY, S * BIG_F, false)
+ local _, big_h = card.measure(cr, big)
card.rgba(cr, colors.body)
- card.text_right(cr, inner.x + inner.w, inner.y + S * BIG_F, big)
+ card.text_right(cr, right - col_w - S * 0.08, base, big)
+ card.font(cr, card.FONT_HEAVY, S * UNIT_F, false)
+ card.text_right(cr, right, base - big_h + unit_h, 'Y')
card.font(cr, card.FONT_MONO, label_size, false)
card.title(cr, inner.x, inner.y + label_size, card.ICON.immich, 'MEMORIES', colors)