Files
mesh-catalog/modules/i3status-rust/files/bin/i3status-value
T
jochen 76b63744e6 Carry the power draw to the bar over the bus, not through a file (hq ADR 0260)
Modules talk over the bus. The power module's bundle puts each fresh reading of its own
sampler in its state draw, keyed by the machine; the bar's block shows that state, which
the bar's bundle watches under the read the mesh grants it. A new catalogue check refuses
a module naming another module's path under /run or /var/lib.
2026-10-08 16:12:37 +02:00

14 lines
672 B
Bash
Executable File

#!/bin/sh
# i3status-value <state> <key> (module i3status-rust, novox/hq ADR 0260): one value another module keeps
# on the bus, for a block it contributed.
#
# This module's own tools bundle watches the state on the bus (the mesh grants it the read) and leaves
# the value's text in this module's own directory; this prints it. A value not refreshed for thirty
# seconds is one its module stopped giving, and prints nothing, so the block hides rather than show an
# old number as if it were now.
dir="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/i3status-rust/values"
f="$dir/$1@$2"
if [ -r "$f" ] && [ $(( $(date +%s) - $(stat -c %Y "$f") )) -le 30 ]; then
head -n 1 "$f"
fi