From 2582f0c4173a4ad6a31e0cb759473c893cdc4e93 Mon Sep 17 00:00:00 2001 From: Kris Yotam <75515498+krisyotam@users.noreply.github.com> Date: Thu, 2 Jul 2026 00:19:35 -0500 Subject: [PATCH] sb-cpu: portable temp source (Intel Core 0, AMD Tdie/Tctl, Asahi NVMe Composite fallback) --- .local/bin/statusbar/sb-cpu | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.local/bin/statusbar/sb-cpu b/.local/bin/statusbar/sb-cpu index 4ff9d378ecb9f2a8f31c23336a99e74e1c4e0623..0aafd079c0b64054c664e2a7e56d43c0e7dbf78b 100755 --- a/.local/bin/statusbar/sb-cpu +++ b/.local/bin/statusbar/sb-cpu @@ -9,4 +9,12 @@ case $BLOCK_BUTTON in 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac -sensors | awk '/Core 0/ {print "🌡" $3}' +# Temperature source, in order of preference: +# Intel x86 -> "Core 0" (field 3, e.g. +45.0°C) +# AMD x86 -> "Tdie/Tctl" (field 2) +# Apple Silicon -> Asahi exposes no CPU die sensor; fall back to the +# NVMe "Composite" temp as a system-temperature proxy +temp=$(sensors 2>/dev/null | awk '/Core 0/ {print $3; exit}') +[ -z "$temp" ] && temp=$(sensors 2>/dev/null | awk '/Tdie|Tctl/ {print $2; exit}') +[ -z "$temp" ] && temp=$(sensors 2>/dev/null | awk '/Composite/ {print $2 $3; exit}') +[ -n "$temp" ] && printf '🌡%s\n' "$temp"