From ee815f9c6651423ae93f8ead237ebc99e2373c06 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 9 Apr 2018 09:51:23 +1000 Subject: [PATCH] gpu: Fixed duplicate intel bug. --- neofetch | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 1b455e56..40f1de05 100755 --- a/neofetch +++ b/neofetch @@ -1284,13 +1284,21 @@ get_gpu() { {if(!seen[a[i]]++) print a[i]}}')) IFS="$old_ifs" - # Number the GPUs if more than one exists. - ((${#gpus[@]} > 1)) && gpu_num=1 + # Remove duplicate Intel Graphics outputs. + # This fixes cases where the outputs are both + # Intel but not entirely identical. + # + # Checking the first two array elements should + # be safe since there won't be 2 intel outputs if + # there's a dedicated GPU in play. + [[ "${gpus[0]}" == *Intel* && \ + "${gpus[1]}" == *Intel* ]] && \ + unset -v "gpus[0]" for gpu in "${gpus[@]}"; do # GPU shorthand tests. - [[ "$gpu_type" == "dedicated" && "$gpu" =~ (i|I)ntel ]] ||\ - [[ "$gpu_type" == "integrated" && ! "$gpu" =~ (i|I)ntel ]] && \ + [[ "$gpu_type" == "dedicated" && "$gpu" == *Intel* ]] || \ + [[ "$gpu_type" == "integrated" && ! "$gpu" == *Intel* ]] && \ { unset -v gpu; continue; } case "$gpu" in @@ -1336,7 +1344,6 @@ get_gpu() { fi prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu" - ((++gpu_num)) done return