From 2e0e3f5d64115920d0cefdef6405b38046ab6dd9 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 12 Feb 2016 00:00:41 +1100 Subject: [PATCH] If a GPU with a prefix of '3D' exists, use it instead. --- fetch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fetch b/fetch index 89736bf1..0e75fdf9 100755 --- a/fetch +++ b/fetch @@ -876,13 +876,18 @@ getcpu () { getgpu () { case "$os" in "Linux") - # Get the GPUs + gpu="$(PATH="/sbin:$PATH" lspci | grep -F "3D")" + + # 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*} count=${count//[[:space:]]} # If there's more than one gpu @@ -895,6 +900,7 @@ getgpu () { # Format the output gpu=${gpu/* VGA compatible controller: } + gpu=${gpu/* 3D controller: } gpu=${gpu/(rev*)} shopt -s nocasematch