Skip to content

Commit

Permalink
[PR] dylanaraps/neofetch#2038 from GustavoSilvera - Improving MacOS M…
Browse files Browse the repository at this point in the history
…1 CPU/GPU prints

Upstream PR: dylanaraps/neofetch#2038
Thanks to @GustavoSilvera

Co-authored-by: Gustavo Silvera <grs5382@gmail.com>
  • Loading branch information
hykilpikonna and GustavoSilvera committed Jul 31, 2022
2 parents 2bd5553 + 75619ed commit 54dbc35
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -2544,8 +2544,14 @@ get_cpu() {
# Add CPU cores to the output.
[[ "$cpu_cores" != "off" && "$cores" ]] && \
case $os in
"Mac OS X"|"macOS") cpu="${cpu/@/(${cores}) @}" ;;
*) cpu="$cpu ($cores)" ;;
"Mac OS X"|"macOS")
if [[ $(uname -m) == 'arm64' ]]; then
cpu="$cpu ($cores)"
else
cpu="${cpu/@/(${cores}) @}"
fi
;;
*) cpu="$cpu ($cores)" ;;
esac

# Add CPU speed to the output.
Expand Down Expand Up @@ -2664,10 +2670,16 @@ get_gpu() {
source "${cache_dir}/neofetch/gpu"

else
gpu="$(system_profiler SPDisplaysDataType |\
awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}')"
gpu="${gpu//\/ \$}"
gpu="${gpu%,*}"
if [[ $(uname -m) == 'arm64' ]]; then
chipset=$(system_profiler SPDisplaysDataType | awk '/Chipset Model/ { printf "%s %s %s", $3, $4, $5 }')
cores=$(system_profiler SPDisplaysDataType | awk '/Total Number of Cores/ { printf "%d", $5 }')
gpu="${chipset} (${cores})"
else
gpu="$(system_profiler SPDisplaysDataType |\
awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}')"
gpu="${gpu//\/ \$}"
gpu="${gpu%,*}"
fi

cache "gpu" "$gpu"
fi
Expand Down

0 comments on commit 54dbc35

Please sign in to comment.