Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/battery_percentage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion scripts/battery_remain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down