#!/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
