From 63a53b07bd14c80c953b7889d0afa61707987567 Mon Sep 17 00:00:00 2001 From: Nicholas Young Date: Thu, 21 May 2020 13:36:59 -0600 Subject: [PATCH] Fix Linux implementation of battery.sh --- scripts/battery.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/battery.sh b/scripts/battery.sh index 30b3b3e..8924558 100755 --- a/scripts/battery.sh +++ b/scripts/battery.sh @@ -1,13 +1,11 @@ #!/usr/bin/env bash -BAT=$(ls /sys/class/power_supply/BAT* | head -1) - battery_percent() { # Check OS case $(uname -s) in Linux) - cat $BAT/capacity + cat /sys/class/power_supply/BAT0/capacity ;; Darwin) @@ -28,7 +26,7 @@ battery_status() # Check OS case $(uname -s) in Linux) - status=$(cat $BAT/status) + status=$(cat /sys/class/power_supply/BAT0/status) ;; Darwin) @@ -43,7 +41,7 @@ battery_status() ;; esac - if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then + if [[ $status = 'discharging' ]] || [[ $status = 'Discharging' ]]; then echo '' else echo 'AC '