aboutsummaryrefslogtreecommitdiffstats
path: root/bin/breaktimer-sample.sh
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 /bin/breaktimer-sample.sh
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 'bin/breaktimer-sample.sh')
-rwxr-xr-xbin/breaktimer-sample.sh70
1 files changed, 0 insertions, 70 deletions
diff --git a/bin/breaktimer-sample.sh b/bin/breaktimer-sample.sh
deleted file mode 100755
index 2bd6f85..0000000
--- a/bin/breaktimer-sample.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash
-# Sample breaktimer's state into a cache file, for widgets/breaktimer.lua.
-#
-# Conky's Lua cannot run a process, so it cannot call `kill -0` to learn whether
-# the daemon is alive, and shelling out every two seconds to ask breaktimer.sh
-# `status` would parse prose rather than read the four small files the daemon
-# already writes under $XDG_RUNTIME_DIR. Those files are the whole interface;
-# this script is the one place that interprets them.
-
-set -u
-
-CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/udt"
-CACHE="$CACHE_DIR/breaktimer.txt"
-
-umask 077
-mkdir -p "$CACHE_DIR"
-
-TMP="$CACHE.tmp.$$"
-trap 'rm -f "$TMP"' EXIT
-
-RUNTIME="${XDG_RUNTIME_DIR:-/tmp}"
-PID_FILE="$RUNTIME/breaktimer.pid"
-STATE_FILE="$RUNTIME/breaktimer.state"
-PHASE_FILE="$RUNTIME/breaktimer.phase"
-REMAIN_FILE="$RUNTIME/breaktimer.remain"
-
-# The daemon's own tick. Used only to decide how stale the remain file may be
-# before the clock counts as frozen.
-TICK=5
-
-running=no
-if [ -f "$PID_FILE" ] && kill -0 "$(cat "$PID_FILE" 2>/dev/null)" 2>/dev/null; then
- running=yes
-fi
-
-state=stopped
-phase=stopped
-remain=0
-if [ "$running" = yes ]; then
- state=$(cat "$STATE_FILE" 2>/dev/null)
- phase=$(cat "$PHASE_FILE" 2>/dev/null)
- remain=$(cat "$REMAIN_FILE" 2>/dev/null)
-fi
-[ -z "$state" ] && state=stopped
-[ -z "$phase" ] && phase=stopped
-case "$remain" in ''|*[!0-9]*) remain=0 ;; esac
-
-# Outside the work-hours window the daemon leaves the phase at 'working' without
-# decrementing, so the remain file stops being rewritten; its age is the honest
-# signal that the clock is frozen. Three ticks of slack, so a sample landing a
-# moment before the next tick never reads as frozen. A paused daemon freezes the
-# file too but reports 'paused' and is handled on its own, and a hung daemon
-# freezes it as well, which is a state worth showing rather than hiding.
-frozen=no
-if [ "$running" = yes ] && [ "$state" = running ] && [ "$phase" = working ] \
- && [ -f "$REMAIN_FILE" ]; then
- mt=$(stat -c %Y "$REMAIN_FILE" 2>/dev/null || echo 0)
- [ $(( $(date +%s) - mt )) -gt $((TICK * 3)) ] && frozen=yes
-fi
-
-{
- echo "generated $(date +%s)"
- echo "running $running"
- echo "state $state"
- echo "phase $phase"
- echo "remain $remain"
- echo "frozen $frozen"
-} > "$TMP"
-
-mv -f "$TMP" "$CACHE"