Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improving MacOS M1 CPU/GPU prints #2038

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -2471,8 +2471,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 @@ -2591,10 +2597,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