From 8540a2f1e30a1233aca663bf23ebb5141630f4d6 Mon Sep 17 00:00:00 2001 From: dylan araps Date: Wed, 13 Dec 2017 08:56:33 +1100 Subject: [PATCH] cpu_temp: Detect CPU temperature file. --- neofetch | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 9cbf8441..a2db5711 100755 --- a/neofetch +++ b/neofetch @@ -926,7 +926,12 @@ get_cpu() { esac speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" - temp_dir="/sys/class/hwmon/hwmon0/temp1_input" + + # Select the right temperature file. + for temp_dir in /sys/class/hwmon/*; do + [[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power) ]] && \ + { temp_dir="${temp_dir}/temp1_input"; break; } + done # Get CPU speed. if [[ -d "$speed_dir" ]]; then