GPU: Print each GPU on a different line
This commit is contained in:
parent
faf1c7d813
commit
57d14905bc
69
neofetch
69
neofetch
|
@ -965,35 +965,48 @@ get_cpu_usage() {
|
||||||
get_gpu() {
|
get_gpu() {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux")
|
"Linux")
|
||||||
gpu="$(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}')"
|
IFS=$'\n'
|
||||||
|
gpus=($(lspci -mm | awk -F '\\"|\\" \\"' '/"Display|"3D|"VGA/ {print $3 " " $4}'))
|
||||||
|
|
||||||
case "$gpu" in
|
for gpu in "${gpus[@]}"; do
|
||||||
*"advanced"*)
|
case "$gpu" in
|
||||||
gpu="${gpu//Intel*$'\n'}"
|
*"advanced"*)
|
||||||
gpu="${gpu/'[AMD/ATI]' }"
|
gpu="${gpu/'[AMD/ATI]' }"
|
||||||
gpu="${gpu/'[AMD]' }"
|
gpu="${gpu/'[AMD]' }"
|
||||||
gpu="${gpu/OEM }"
|
gpu="${gpu/OEM }"
|
||||||
gpu="${gpu/Advanced Micro Devices, Inc.}"
|
gpu="${gpu/Advanced Micro Devices, Inc.}"
|
||||||
gpu="${gpu/ \/ *}"
|
gpu="${gpu/ \/ *}"
|
||||||
gpu="${gpu/*\[}"
|
gpu="${gpu/*\[}"
|
||||||
gpu="${gpu/\]*}"
|
gpu="${gpu/\]*}"
|
||||||
gpu="AMD $gpu"
|
gpu="AMD $gpu"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"nvidia"*)
|
*"nvidia"*)
|
||||||
gpu="${gpu//Intel*$'\n'}"
|
gpu="${gpu/*\[}"
|
||||||
gpu="${gpu/*\[}"
|
gpu="${gpu/\]*}"
|
||||||
gpu="${gpu/\]*}"
|
gpu="NVIDIA $gpu"
|
||||||
gpu="NVIDIA $gpu"
|
;;
|
||||||
;;
|
|
||||||
|
|
||||||
*"virtualbox"*)
|
*"intel"*)
|
||||||
gpu="VirtualBox Graphics Adapter"
|
gpu="Intel Integrated Graphics"
|
||||||
;;
|
;;
|
||||||
esac
|
|
||||||
|
|
||||||
[[ "$gpu" == *"intel"* ]] && \
|
*"virtualbox"*)
|
||||||
gpu="Intel Integrated Graphics"
|
gpu="VirtualBox Graphics Adapter"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$gpu_brand" == "off" ]]; then
|
||||||
|
gpu="${gpu//AMD }"
|
||||||
|
gpu="${gpu//NVIDIA }"
|
||||||
|
gpu="${gpu//Intel }"
|
||||||
|
fi
|
||||||
|
|
||||||
|
prin "GPU${index:-0}" "$gpu"
|
||||||
|
index="$((index+=1))"
|
||||||
|
done
|
||||||
|
|
||||||
|
return
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
|
@ -1067,9 +1080,9 @@ get_gpu() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$gpu_brand" == "off" ]]; then
|
if [[ "$gpu_brand" == "off" ]]; then
|
||||||
gpu="${gpu/AMD}"
|
gpu="${gpu//AMD}"
|
||||||
gpu="${gpu/NVIDIA}"
|
gpu="${gpu//NVIDIA}"
|
||||||
gpu="${gpu/Intel}"
|
gpu="${gpu//Intel}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue