From d65aa4bc6b8febccb1a3e67ad12f09d9e62f6d5a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 13 Jun 2016 19:40:54 +1000 Subject: [PATCH] Fix cpu usage --- neofetch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 946f9a95..d1111355 100755 --- a/neofetch +++ b/neofetch @@ -1149,13 +1149,13 @@ getcpu () { if [ "$cpu_display" != "off" ]; then cpu_usage="$(ps aux | awk 'BEGIN { sum = 0 } { sum += $3 }; END { print sum }')" - cpu_usage="${cpu_usage/\.*}%" + cpu_usage=$((${cpu_usage/\.*} / cores)) case "$cpu_display" in - "info") prin "$subtitle Usage" "$cpu_usage" ;; - "bar") prin "$subtitle Usage" "$(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;; - "infobar") prin "$subtitle Usage" "${cpu_usage} $(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;; - "barinfo") prin "$subtitle Usage" "$(bar "${cpu_usage/'%'}" $(( 100 * cores ))) $cpu_usage" ;; + "info") prin "$subtitle Usage" "${cpu_usage}%" ;; + "bar") prin "$subtitle Usage" "$(bar "$cpu_usage" 100)" ;; + "infobar") prin "$subtitle Usage" "${cpu_usage}% $(bar $cpu_usage 100)" ;; + "barinfo") prin "$subtitle Usage" "$(bar $cpu_usage 100) ${cpu_usage}%" ;; esac fi [ "$stdout_mode" != "on" ] && unset cpu