From 7d65ae513d8660937087e62e6a3fd8d28c9d2760 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 5 Jan 2017 10:57:28 +1100 Subject: [PATCH] CPU Usage: re-detect cores if set to physical or off --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 00448ceb..fb0d3ccd 100755 --- a/neofetch +++ b/neofetch @@ -967,7 +967,7 @@ get_cpu_usage() { *) # Get CPU cores if unset. - if [[ "$cpu_cores" == "off" ]]; then + if [[ "$cpu_cores" != "logical" ]]; then case "$os" in "Linux" | "MINIX") cores="$(grep -c "^processor" /proc/cpuinfo)" ;; "Mac OS X") cores="$(sysctl -n hw.logicalcpu_max)" ;; @@ -978,7 +978,7 @@ get_cpu_usage() { esac fi - cpu_usage="$(ps aux | awk 'BEGIN {sum=0} {sum+=$3 }; END {print sum}')" + cpu_usage="$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {print sum}')" cpu_usage="$((${cpu_usage/\.*} / ${cores:-1}))" ;; esac