GPU: Start rewrite
This commit is contained in:
parent
cc9095ccd5
commit
0177837f69
56
neofetch
56
neofetch
|
@ -989,63 +989,25 @@ getgpu() {
|
||||||
"Linux")
|
"Linux")
|
||||||
gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')"
|
gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')"
|
||||||
|
|
||||||
# If a GPU with a prefix of '3D' doesn't exist
|
|
||||||
# fallback to looking for a prefix of 'VGA'
|
|
||||||
# [ -z "$gpu" ] && \
|
|
||||||
# gpu="$(PATH="/sbin:$PATH" lspci | grep -F "VGA")"
|
|
||||||
|
|
||||||
gpu="${gpu//??':'??'.'?}"
|
|
||||||
|
|
||||||
# Count the number of GPUs
|
|
||||||
count="$(printf "%s" "$gpu" | uniq -c)"
|
|
||||||
count="${count/ VGA*}"
|
|
||||||
count="${count/ 3D*}"
|
|
||||||
|
|
||||||
# If there's more than one gpu
|
|
||||||
# Display the count.
|
|
||||||
if [ "$count" -gt 1 ]; then
|
|
||||||
count=" x $count"
|
|
||||||
else
|
|
||||||
unset count
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Format the output
|
|
||||||
gpu="${gpu/* VGA compatible controller: }"
|
|
||||||
gpu="${gpu/* 3D controller: }"
|
|
||||||
gpu="${gpu/(rev*)}"
|
|
||||||
gpu="${gpu/\[}"
|
|
||||||
gpu="${gpu/\]}"
|
|
||||||
|
|
||||||
case "$gpu" in
|
case "$gpu" in
|
||||||
intel*)
|
intel*) gpu="Intel Integrated Graphics" ;;
|
||||||
gpu="Intel Integrated Graphics"
|
|
||||||
;;
|
|
||||||
|
|
||||||
advanced*)
|
advanced*)
|
||||||
gpu="${gpu/Advanced Micro Devices, Inc\. }"
|
|
||||||
gpu="${gpu/'[AMD/ATI]' }"
|
gpu="${gpu/'[AMD/ATI]' }"
|
||||||
gpu="${gpu/Tahiti PRO}"
|
gpu="${gpu/'[AMD]' }"
|
||||||
gpu="${gpu/XTX}"
|
gpu="${gpu/*\[}"
|
||||||
gpu="${gpu/ OEM}"
|
gpu="${gpu/\]*}"
|
||||||
gpu="${gpu/*Radeon/Radeon}"
|
|
||||||
|
|
||||||
brand="AMD "
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
nvidia*)
|
nvidia*)
|
||||||
gpu="${gpu/NVIDIA Corporation }"
|
gpu="${gpu/*\[}"
|
||||||
gpu="${gpu/G????M }"
|
gpu="${gpu/\]*}"
|
||||||
gpu="${gpu/G???? }"
|
|
||||||
|
|
||||||
brand="NVIDIA "
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*virtualbox*)
|
*virtualbox*)
|
||||||
gpu="VirtualBox Graphics Adapter"
|
gpu="VirtualBox Graphics Adapter"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
gpu="${brand}${gpu}"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
|
@ -1137,11 +1099,7 @@ getgpu() {
|
||||||
case "$gpu_shorthand" in
|
case "$gpu_shorthand" in
|
||||||
"on" | "tiny")
|
"on" | "tiny")
|
||||||
gpu="${gpu// Rev\. ?}"
|
gpu="${gpu// Rev\. ?}"
|
||||||
gpu="${gpu//AMD*\/ATI\]/AMD}"
|
|
||||||
gpu="${gpu// Tahiti}"
|
|
||||||
gpu="${gpu// PRO}"
|
|
||||||
gpu="${gpu// OEM}"
|
gpu="${gpu// OEM}"
|
||||||
gpu="${gpu// Mars}"
|
|
||||||
gpu="${gpu// Series}"
|
gpu="${gpu// Series}"
|
||||||
gpu="${gpu// Controller}"
|
gpu="${gpu// Controller}"
|
||||||
gpu="${gpu/\/*}"
|
gpu="${gpu/\/*}"
|
||||||
|
@ -2427,7 +2385,7 @@ info() {
|
||||||
eval output="\$${1}"
|
eval output="\$${1}"
|
||||||
|
|
||||||
else
|
else
|
||||||
time "get$2" 2>/dev/null
|
"get$2" 2>/dev/null
|
||||||
eval output="\$${2}"
|
eval output="\$${2}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Reference in New Issue