From 6dc4277b4fa916e8efe00378bd2381b0f791335c Mon Sep 17 00:00:00 2001 From: Dylan Date: Thu, 3 Mar 2016 11:18:28 +1100 Subject: [PATCH] Cleanup the battery function --- neofetch | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 0e0226ff..487a16ed 100755 --- a/neofetch +++ b/neofetch @@ -1408,18 +1408,16 @@ getbattery () { battery="${battery}%" else - # If there's only a single battery and it's battery 0, - # don't number the subtitle. - if [ "${#batteries[@]}" == 1 ]; then - battery="${batteries[0]}%" + if [ "${#batteries[@]}" -gt 1 ]; then + # Print each battery on a separate line. + for bat in "${batteries[@]}"; do + prin "${title}${index}: ${bat}%" + index=$((index + 1)) + done return fi - # Print each battery on a separate line. - for bat in "${batteries[@]}"; do - prin "${title}${index}: ${bat}%" - index=$((index + 1)) - done + battery="${batteries[0]}%" fi else battery="None"