summaryrefslogtreecommitdiff
path: root/ar/.local/bin/statusbar/sb-system
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.local/bin/statusbar/sb-system')
-rwxr-xr-xar/.local/bin/statusbar/sb-system7
1 files changed, 7 insertions, 0 deletions
diff --git a/ar/.local/bin/statusbar/sb-system b/ar/.local/bin/statusbar/sb-system
index b2e28af..48addca 100755
--- a/ar/.local/bin/statusbar/sb-system
+++ b/ar/.local/bin/statusbar/sb-system
@@ -21,6 +21,13 @@ DISK_LOCATION=${1:-/}
CACHE_DIR=/tmp/sb-system
mkdir -p "$CACHE_DIR"
+# Clear stale caches on first run (e.g. dwmblocks restart)
+LOCK="$CACHE_DIR/.started"
+if [ ! -f "$LOCK" ]; then
+ rm -f "$CACHE_DIR"/cpu "$CACHE_DIR"/cpubars "$CACHE_DIR"/cpubars_prev "$CACHE_DIR"/memory "$CACHE_DIR"/disk*
+ touch "$LOCK"
+fi
+
# ── Helper: check if cache is stale ────────────────────────
# usage: is_stale <cache_file> <interval_seconds>
is_stale() {