From 511e87c1df0b314b09b207b3ee80610ecceab717 Mon Sep 17 00:00:00 2001 From: Krzysztof Rudnicki Date: Fri, 15 Nov 2024 14:08:07 +0100 Subject: [PATCH] fix: lack of cpu temperature for intel cpu --- i3blocks/cpu_monitor.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/i3blocks/cpu_monitor.sh b/i3blocks/cpu_monitor.sh index 0348649..e4df163 100755 --- a/i3blocks/cpu_monitor.sh +++ b/i3blocks/cpu_monitor.sh @@ -3,7 +3,10 @@ # CPU Temperature cpu_temp=$(sensors | awk '/^Tctl:/ {print $2}' | tr -d '+°C') if [ -z "$cpu_temp" ]; then - cpu_temp=$(sensors | awk '/^Package id 0:/ {print $3}' | tr -d '+°C') + cpu_temp=$(sensors | awk '/^Package id 0:/ {print $4}' | tr -d '+°C') +fi +if [ -z "$cpu_temp" ]; then + cpu_temp=$(sensors | awk '/^Core 0:/ {print $3}' | tr -d '+°C') fi if [ -z "$cpu_temp" ]; then cpu_temp="N/A" @@ -22,8 +25,4 @@ if [[ "$cpu_load" != "N/A" ]]; then : fi -cpu_metrics=$(echo "CPU Temp: $cpu_temp°C, CPU Load: $cpu_load, Color: $cpu_color") -cpu_temp=$(echo "$cpu_metrics" | awk -F', ' '{print $1}' | awk -F': ' '{print $2}') -cpu_load=$(echo "$cpu_metrics" | awk -F', ' '{print $2}' | awk -F': ' '{print $2}') -cpu_color=$(echo "$cpu_metrics" | awk -F', ' '{print $3}' | awk -F': ' '{print $2}') -echo -e " CPU: ${cpu_temp}, Load: ${cpu_load}" \ No newline at end of file +echo -e " CPU: ${cpu_temp}°C, Load: ${cpu_load}" \ No newline at end of file