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.
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
# power-draw (module power, novox/hq ADR 0255): the power the machine draws, for the bar's block.
|
||||
#
|
||||
# Prints the line the module's sampler (`power draw`, as root) publishes every five seconds, which says
|
||||
# what it measured: "machine" on battery, "CPU" or "CPU+GPU" otherwise. A line older than thirty
|
||||
# seconds is a sampler that stopped, and is not shown as if it were now.
|
||||
f="${MESH_POWER_DRAW:-/run/mesh-power/draw}"
|
||||
if [ -r "$f" ] && [ $(( $(date +%s) - $(stat -c %Y "$f") )) -le 30 ]; then
|
||||
head -n 1 "$f"
|
||||
else
|
||||
echo "power not measured"
|
||||
fi
|
||||
Reference in New Issue
Block a user