GPU: Print each GPU on a different line
This commit is contained in:
parent
faf1c7d813
commit
57d14905bc
1 changed files with 41 additions and 28 deletions
29
neofetch
29
neofetch
|
@ -965,11 +965,12 @@ 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}'))
|
||||||
|
|
||||||
|
for gpu in "${gpus[@]}"; do
|
||||||
case "$gpu" in
|
case "$gpu" in
|
||||||
*"advanced"*)
|
*"advanced"*)
|
||||||
gpu="${gpu//Intel*$'\n'}"
|
|
||||||
gpu="${gpu/'[AMD/ATI]' }"
|
gpu="${gpu/'[AMD/ATI]' }"
|
||||||
gpu="${gpu/'[AMD]' }"
|
gpu="${gpu/'[AMD]' }"
|
||||||
gpu="${gpu/OEM }"
|
gpu="${gpu/OEM }"
|
||||||
|
@ -981,19 +982,31 @@ get_gpu() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"nvidia"*)
|
*"nvidia"*)
|
||||||
gpu="${gpu//Intel*$'\n'}"
|
|
||||||
gpu="${gpu/*\[}"
|
gpu="${gpu/*\[}"
|
||||||
gpu="${gpu/\]*}"
|
gpu="${gpu/\]*}"
|
||||||
gpu="NVIDIA $gpu"
|
gpu="NVIDIA $gpu"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
*"intel"*)
|
||||||
|
gpu="Intel Integrated Graphics"
|
||||||
|
;;
|
||||||
|
|
||||||
*"virtualbox"*)
|
*"virtualbox"*)
|
||||||
gpu="VirtualBox Graphics Adapter"
|
gpu="VirtualBox Graphics Adapter"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[[ "$gpu" == *"intel"* ]] && \
|
if [[ "$gpu_brand" == "off" ]]; then
|
||||||
gpu="Intel Integrated Graphics"
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue