Skip to content

Commit ee815f9

Browse files
committed
gpu: Fixed duplicate intel bug.
1 parent 4083770 commit ee815f9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

neofetch

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,13 +1284,21 @@ get_gpu() {
12841284
{if(!seen[a[i]]++) print a[i]}}'))
12851285
IFS="$old_ifs"
12861286

1287-
# Number the GPUs if more than one exists.
1288-
((${#gpus[@]} > 1)) && gpu_num=1
1287+
# Remove duplicate Intel Graphics outputs.
1288+
# This fixes cases where the outputs are both
1289+
# Intel but not entirely identical.
1290+
#
1291+
# Checking the first two array elements should
1292+
# be safe since there won't be 2 intel outputs if
1293+
# there's a dedicated GPU in play.
1294+
[[ "${gpus[0]}" == *Intel* && \
1295+
"${gpus[1]}" == *Intel* ]] && \
1296+
unset -v "gpus[0]"
12891297

12901298
for gpu in "${gpus[@]}"; do
12911299
# GPU shorthand tests.
1292-
[[ "$gpu_type" == "dedicated" && "$gpu" =~ (i|I)ntel ]] ||\
1293-
[[ "$gpu_type" == "integrated" && ! "$gpu" =~ (i|I)ntel ]] && \
1300+
[[ "$gpu_type" == "dedicated" && "$gpu" == *Intel* ]] || \
1301+
[[ "$gpu_type" == "integrated" && ! "$gpu" == *Intel* ]] && \
12941302
{ unset -v gpu; continue; }
12951303

12961304
case "$gpu" in
@@ -1336,7 +1344,6 @@ get_gpu() {
13361344
fi
13371345

13381346
prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu"
1339-
((++gpu_num))
13401347
done
13411348

13421349
return

0 commit comments

Comments
 (0)