diff options
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/status/sb-battery | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/.local/bin/status/sb-battery b/.local/bin/status/sb-battery index 8787bff..e2a23ef 100755 --- a/.local/bin/status/sb-battery +++ b/.local/bin/status/sb-battery @@ -2,20 +2,24 @@ case $(hostname -s) in mother) return ;; - po-rbo) [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && echo -n "ﮣ " ;; - mars) [ "$(apm -b)" -eq 3 ] && echo -n "ﮣ " ;; -esac - -case $(hostname -s) in - po-rbo) charge=$(cat /sys/class/power_supply/BAT0/capacity) ;; - mars) charge=$(apm -l) ;; + po-rbo) + charge=$(cat /sys/class/power_supply/BAT0/capacity) + [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && printf " " + [ "$(cat /sys/class/power_supply/BAT0/status)" = "Not charging" ] && printf " " + ;; + mars) + charge=$(apm -l) + [ "$(apm -b)" -eq 3 ] && printf " " + ;; esac case $(echo "$charge" / 20 | bc) in - "0") printf " ";; - "1") printf " ";; - "2") printf " ";; - "3") printf " ";; - "4") printf " ";; - "5") printf "ﮣ ";; + "0") printf " " ;; + "1") printf " " ;; + "2") printf " " ;; + "3") printf " " ;; + "4") + [ "$charge" -gt 94 ] && return + printf " " + ;; esac |