From 6dbdaa4a63fcde231d015d8761d5d943d9431401 Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Mon, 12 Dec 2016 16:40:03 -0500 Subject: [PATCH 1/2] Fix always charging bug --- neofetch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 9b6add40..7419c5e2 100755 --- a/neofetch +++ b/neofetch @@ -1709,7 +1709,11 @@ get_battery() { "Mac OS X") battery="$(pmset -g batt | grep -o '[0-9]*%')" - battery_state="$(pmset -g batt | awk 'NR==2 {print $3}')" + state="$(pmset -g batt | awk '/;/ {print $4}')" + if [ "$state" == "charging;" ]; + then + battery_state="charging" + fi ;; "Windows") From da251b8bc92b9adfac54846e4194ce77291786a0 Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Mon, 12 Dec 2016 17:57:49 -0500 Subject: [PATCH 2/2] Change to one-line if statement --- neofetch | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 7419c5e2..09b9fdf0 100755 --- a/neofetch +++ b/neofetch @@ -1710,10 +1710,7 @@ get_battery() { "Mac OS X") battery="$(pmset -g batt | grep -o '[0-9]*%')" state="$(pmset -g batt | awk '/;/ {print $4}')" - if [ "$state" == "charging;" ]; - then - battery_state="charging" - fi + [[ "$state" == "charging;" ]] && battery_state="charging" ;; "Windows")