1
0
Fork 0

sb-cpu: fix spacing when no temperature shown

This commit is contained in:
Luca Bilke 2024-09-26 11:15:11 +02:00
parent 44f1d24434
commit 29b0a33569
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,8 @@
n_cpu=$(grep -c 'cpu[0-9]\+' /proc/stat)
cache=$XDG_RUNTIME_DIR/cpubarscache
temp="$(sensors | awk '/CPU/ {printf ("%.f°C", $2)}' | tr -d "+") "
temp="$(sensors | awk '/CPU/ {printf ("%.f°C", $2)}' | tr -d "+")"
[ -n "$temp" ] && temp="${temp} "
new=$(awk '/cpu[0-9]+/ { printf "%d %d\n", $5, ($2 + $3 + $4 + $5) }' /proc/stat 2>/dev/null)
@ -19,7 +20,6 @@ printf "%b" " $temp<span ${bggray}>"
first=true
IFS='
'
for i in $(seq "$n_cpu"); do
old_idle=$(echo "$old" | awk -v i="$i" 'NR==i { print $1 }')
old_total=$(echo "$old" | awk -v i="$i" 'NR==i { print $2 }')