Commit a2290b73 authored by dylan araps's avatar dylan araps

cpu_temp: $temp is an environment variable on Windows.

parent 9f263fe1
...@@ -949,8 +949,8 @@ get_cpu() { ...@@ -949,8 +949,8 @@ get_cpu() {
# Get CPU temp. # Get CPU temp.
if [[ -f "$temp_dir" ]]; then if [[ -f "$temp_dir" ]]; then
temp="$(< "$temp_dir")" deg="$(< "$temp_dir")"
temp="$((temp * 100 / 10000))" deg="$((deg * 100 / 10000))"
fi fi
# Get CPU cores. # Get CPU cores.
...@@ -1013,12 +1013,12 @@ get_cpu() { ...@@ -1013,12 +1013,12 @@ get_cpu() {
# Get CPU temp. # Get CPU temp.
case "$kernel_name" in case "$kernel_name" in
"FreeBSD"* | "DragonFly"* | "NetBSD"*) "FreeBSD"* | "DragonFly"* | "NetBSD"*)
temp="$(sysctl -n dev.cpu.0.temperature)" deg="$(sysctl -n dev.cpu.0.temperature)"
temp="${temp/C}" deg="${deg/C}"
;; ;;
"OpenBSD"* | "Bitrig"*) "OpenBSD"* | "Bitrig"*)
temp="$(sysctl -n hw.sensors.lm0.temp0)" deg="$(sysctl -n hw.sensors.lm0.temp0)"
temp="${temp/ degC}" deg="${deg/ degC}"
;; ;;
esac esac
;; ;;
...@@ -1135,15 +1135,15 @@ get_cpu() { ...@@ -1135,15 +1135,15 @@ get_cpu() {
fi fi
# Add CPU temp to the output. # Add CPU temp to the output.
if [[ "$cpu_temp" != "off" && "$temp" ]]; then if [[ "$cpu_temp" != "off" && "$deg" ]]; then
temp="${temp//.}" deg="${deg//.}"
# Convert to Fahrenheit if enabled # Convert to Fahrenheit if enabled
[[ "$cpu_temp" == "F" ]] && temp="$((temp * 90 / 50 + 320))" [[ "$cpu_temp" == "F" ]] && deg="$((deg * 90 / 50 + 320))"
# Format the output # Format the output
temp="[${temp/${temp: -1}}.${temp: -1}°${cpu_temp:-C}]" deg="[${deg/${deg: -1}}.${deg: -1}°${cpu_temp:-C}]"
cpu="$cpu $temp" cpu="$cpu $deg"
fi fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment