aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data.lua
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-30 17:34:26 +0100
committerDanilo M. <danix@danix.xyz>2026-10-30 17:34:26 +0100
commit4506646c66c5c5d05278fe2ada76b482e142f09e (patch)
tree14b1908a9f5e1ad0a5a53862a869a3d7f67283b6 /lib/data.lua
parent6b08e092b9e1e0774c2ad81dcf414c9095d87cf9 (diff)
downloadconky-theme-udt-4506646c66c5c5d05278fe2ada76b482e142f09e.tar.gz
conky-theme-udt-4506646c66c5c5d05278fe2ada76b482e142f09e.zip
Remove the breaktimer cardHEADmaster
breaktimer is parked and no longer runs, so the card only ever showed "no breaktimer data". Drop the widget, its sampler and the texeci that ran it every 5s, the parser and its tests, the icon, and the doc examples that used it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/data.lua')
-rw-r--r--lib/data.lua74
1 files changed, 0 insertions, 74 deletions
diff --git a/lib/data.lua b/lib/data.lua
index 818bbf1..dca039a 100644
--- a/lib/data.lua
+++ b/lib/data.lua
@@ -162,80 +162,6 @@ function M.month_shape(year, month)
return last.day, (first.wday + 5) % 7 + 1
end
--- The breaktimer cache written by bin/breaktimer-sample.sh.
---
--- Returns a table describing the daemon, or nil when the cache is absent or
--- carries no 'generated' key (the sampler never ran). The display strings are
--- derived here rather than in the widget so the phase-to-word and
--- phase-to-colour decisions can be tested without Cairo:
---
--- { running, state, phase, frozen, remain,
--- countdown = '24:31' or '--',
--- phase_label = 'working' | 'micro-pausa' | 'pausa lunga' | 'in pausa'
--- | 'outside working hours' | 'fermo',
--- next = 'pausa' | 'lavoro' | '--',
--- role = 'ok' | 'heading' | 'highlight' | 'warning' | 'label' }
---
--- `frozen` is the sampler's read of whether the clock is ticking: the phase is
--- 'working' but the remain file has stopped being rewritten. Outside the work
--- window that is normal and reads as such; a hung daemon looks the same, and
--- should.
---
--- The countdown leads to the next phase, but the daemon keeps the cycle count
--- in memory and never writes it, so whether the NEXT break is a micro or a long
--- one is not knowable here. 'pausa' is the honest answer; the phase word carries
--- the rest.
-function M.breaktimer_parse(text)
- if type(text) ~= 'string' then return nil end
- local kv = M.kv_parse(text)
- if not kv.generated then return nil end
-
- local running = kv.running == 'yes'
- local state = kv.state or 'stopped'
- local phase = kv.phase or 'stopped'
- local remain = tonumber(kv.remain) or 0
- if remain < 0 then remain = 0 end
-
- local out = {
- running = running,
- state = state,
- phase = phase,
- frozen = kv.frozen == 'yes',
- remain = remain,
- }
-
- -- Not running and stopped are the same thing on the card. The sampler's
- -- liveness check is what turns a dead PID into this reading: the state file
- -- can still say 'running' after a crash or a kill -9.
- if not running or state == 'stopped' then
- out.countdown = '--'
- out.phase_label = 'fermo'
- out.next = '--'
- out.role = 'label'
- return out
- end
-
- out.countdown = string.format('%d:%02d', math.floor(remain / 60), remain % 60)
-
- if state == 'paused' then
- out.phase_label = 'in pausa'
- out.role = 'warning'
- elseif out.frozen then
- out.phase_label = 'outside working hours'
- out.role = 'label'
- else
- local labels = { working = 'working', breaking = 'micro-pausa',
- longbreak = 'pausa lunga' }
- local roles = { working = 'ok', breaking = 'heading',
- longbreak = 'highlight' }
- out.phase_label = labels[phase] or phase
- out.role = roles[phase] or 'value'
- end
-
- out.next = (phase == 'working') and 'pausa' or 'lavoro'
- return out
-end
-
-- The Immich memories index written by bin/immich-fetch.sh.
--
-- Returns a list of { id, year, taken = { y, m, d, H, M }, place }, plus