diff --git a/scripts/battery_percentage.sh b/scripts/battery_percentage.sh index 7061ec4..17e10de 100755 --- a/scripts/battery_percentage.sh +++ b/scripts/battery_percentage.sh @@ -9,7 +9,7 @@ print_battery_percentage() { if command_exists "pmset"; then pmset -g batt | grep -o "[0-9]\{1,3\}%" elif command_exists "acpi"; then - acpi -b | grep -m 1 -Eo "[0-9]+%" + acpi -b | grep -v " 0%" | grep -m 1 -Eo "[0-9]+%" elif command_exists "upower"; then # use DisplayDevice if available otherwise battery local battery=$(upower -e | grep -E 'battery|DisplayDevice'| tail -n1) diff --git a/scripts/battery_remain.sh b/scripts/battery_remain.sh index f456b2f..881206b 100755 --- a/scripts/battery_remain.sh +++ b/scripts/battery_remain.sh @@ -110,9 +110,10 @@ acpi_battery_remaining_time() { if ! $short; then regex="$regex:[0-9]+" fi - acpi -b | grep -m 1 -Eo "$regex" + acpi -b | grep -v " 0%" | grep -m 1 -Eo "$regex" } + print_battery_remain() { if is_wsl; then echo "?" # currently unsupported on WSL