From c62901c2036808d5caacebeb247ca1f82eb0c6c0 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 29 Nov 2016 21:16:26 +1100 Subject: [PATCH 1/3] GPU: Prefer dedicated card over intel card --- neofetch | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/neofetch b/neofetch index 1c64c568..bc1cdba7 100755 --- a/neofetch +++ b/neofetch @@ -927,21 +927,12 @@ get_gpu() { if [[ -f "/tmp/neofetch/gpu" ]]; then source "/tmp/neofetch/gpu" else - bdf_number="$(PATH="/sbin:$PATH" lspci -k | grep -A2 -F 'VGA' | grep -B2 -F 'Kernel driver in use' | awk '/^\w/ {print $1}')" - - if [[ -z "$bdf_number" ]]; then - # Fallback if no kernel driver is in use - gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" - - else - # Find the currently used GPU by its BDF - gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -v bdf_number="$bdf_number" -F '\\"|\\" \\"' '$0 ~ bdf_number {print $3 " " $4}')" - fi + # Fallback if no kernel driver is in use + gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" case "$gpu" in - "intel"*) gpu="Intel Integrated Graphics" ;; - - "advanced"*) + *"advanced"*) + gpu="${gpu//Intel*$'\n'}" gpu="${gpu/'[AMD/ATI]' }" gpu="${gpu/'[AMD]' }" gpu="${gpu/*\[}" @@ -949,7 +940,8 @@ get_gpu() { gpu="AMD $gpu" ;; - "nvidia"*) + *"nvidia"*) + gpu="${gpu//Intel*$'\n'}" gpu="${gpu/*\[}" gpu="${gpu/\]*}" gpu="NVIDIA $gpu" @@ -959,6 +951,10 @@ get_gpu() { gpu="VirtualBox Graphics Adapter" ;; esac + + [[ "$gpu" =~ "intel" ]] && \ + gpu="Intel Integrated Graphics" + cache "gpu" "$gpu" "/tmp" fi ;; From 07c4f9fc52a904847d8524d45ecef4e85074fee2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 29 Nov 2016 21:20:55 +1100 Subject: [PATCH 2/3] GPU: Remove comment --- neofetch | 1 - 1 file changed, 1 deletion(-) diff --git a/neofetch b/neofetch index bc1cdba7..8e357583 100755 --- a/neofetch +++ b/neofetch @@ -927,7 +927,6 @@ get_gpu() { if [[ -f "/tmp/neofetch/gpu" ]]; then source "/tmp/neofetch/gpu" else - # Fallback if no kernel driver is in use gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" case "$gpu" in From 691dc9bad4c1192da300c16ef616c21ca915136b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 30 Nov 2016 07:06:34 +1100 Subject: [PATCH 3/3] GPU: [Linux] lspci, look for 'Display' --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 8e357583..83dd8745 100755 --- a/neofetch +++ b/neofetch @@ -927,7 +927,7 @@ get_gpu() { if [[ -f "/tmp/neofetch/gpu" ]]; then source "/tmp/neofetch/gpu" else - gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" + gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/Display|3D|VGA/ {print $3 " " $4}')" case "$gpu" in *"advanced"*)