minor uplifts

This commit is contained in:
Solomon Laing 2023-03-30 21:42:20 +10:30
parent 5d74d499e1
commit 8aa99de402
3 changed files with 14 additions and 14 deletions

View File

@ -6,9 +6,9 @@ readarray -t batteries < <(upower -e | grep 'BAT')
allstate=""
for battery in ${batteries[@]}
for battery in "${batteries[@]}"
do
current=$(($current + $(upower -i "$battery" | grep -E "percentage" | sed 's/.*://' | sed 's/ *//' | sed 's/\%//')))
current=$(("$current" + $(upower -i "$battery" | grep -E "percentage" | sed 's/.*://' | sed 's/ *//' | sed 's/\%//')))
state=$(upower -i "$battery" | grep -E "state" | sed 's/.*://' | sed 's/ *//')
allstate=$allstate$state
@ -18,7 +18,7 @@ if [[ "$allstate" == *"discharging"* ]]; then
state="discharging"
elif [[ "$allstate" == *"charging"* ]]; then
state="charging"
elif [[ "$allstate" == "not-chargingnot-charging" || "$allstate" == "fully-chargedfully-charged" ]]; then
elif [[ "$allstate" == "not-chargingnot-charging" || "$allstate" == "fully-chargedfully-charged" || "$allstate" == "not-charging" || "$allstate" == "fully-charged" ]]; then
state="full"
else
state="N/A"

View File

@ -33,7 +33,7 @@ case $state in
not-charging)
icon=" "
;;
fully-charged)
fully-charged|full)
icon=" "
status="Full"
;;

View File

@ -5,7 +5,7 @@
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
# If muted, print 🔇 and exit.
[ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit
[ "$vol" != "${vol%\[MUTED\]}" ] && echo " " && exit
vol="${vol#Volume: }"