From c176e6ffaef6394969159485fa9b5851df4d36f6 Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Thu, 11 Aug 2022 22:12:20 -0400 Subject: [PATCH] [O] Display number of sockets for multi-cpu systems Fix for https://github.com/dylanaraps/neofetch/issues/1574 Corrected implementation of https://github.com/dylanaraps/neofetch/pull/1585 --- neofetch | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index cc4c51ba..bc0f56fd 100755 --- a/neofetch +++ b/neofetch @@ -2531,6 +2531,8 @@ get_cpu() { ;; *) + sockets="$(grep "physical id" /proc/cpuinfo | sort -u | wc -l)" + case $cpu_cores in "logical" | "on") cores="$(grep -c "^processor" "$cpu_file")" @@ -2550,8 +2552,8 @@ get_cpu() { speed="$(system_profiler SPHardwareDataType | grep CPU\ Speed)" speed="${speed/CPU\ Speed\:/}" - speed="${speed/ MHz/}" - speed="${speed/ GHz/}" + speed="${speed/ MHz/}" + speed="${speed/ GHz/}" cores="$(system_profiler SPHardwareDataType | grep Number\ Of\ CPUs)" cores="${cores/Number\ Of\ CPUs\:/}" @@ -2753,7 +2755,14 @@ get_cpu() { cpu="${cpu/@/(${cores}) @}" fi ;; - *) cpu="$cpu ($cores)" ;; + *) + # If socket information is present and more than 1, display cpu count first + if [[ $sockets ]] && [[ $sockets -gt 1 ]]; then + cpu="${sockets}x $cpu $((cores / sockets))" + else + cpu="$cpu ($cores)" + fi + ;; esac # Add CPU speed to the output.