mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-12-23 03:59:58 +00:00
Don't get CPU usage if we're not going to use it
This commit is contained in:
3
neofetch
3
neofetch
@@ -934,6 +934,7 @@ getcpu () {
|
||||
# Add CPU info bar
|
||||
prin "${subtitle}: ${cpu}"
|
||||
|
||||
if [ "$cpu_display" != "off" ]; then
|
||||
cpu_usage="$(ps aux | awk 'BEGIN { sum = 0 } { sum += $3 }; END { print sum }')"
|
||||
cpu_usage="${cpu_usage/\.*}%"
|
||||
|
||||
@@ -942,8 +943,8 @@ getcpu () {
|
||||
"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}" ;;
|
||||
"off") ;;
|
||||
esac
|
||||
fi
|
||||
[ "$stdout_mode" != "on" ] && unset cpu
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user