commit 380d1b42319d9539e6ffa700edb4b6e1c5136587
parent 8ec761c77153f60f0091322a77aef661e8f15828
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date: Fri, 27 Mar 2026 18:55:43 +0100
dwmblock-cpu: add free memory
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/scripts/dwmblock-cpu b/scripts/dwmblock-cpu
@@ -14,6 +14,10 @@ case "$BUTTON" in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
+# Available memory
+free -h | awk '/^Mem:/ { printf "MEM +%s ", $NF }'
+
+# CPU
# id total idle
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
[ ! -f $cache ] && echo "$stats" > "$cache" && exit