fix(battery-remain): fix with acpi and @batt_remain_short option (#112)

This commit is contained in:
Tomasz Kania-Orzeł 2023-12-01 09:37:22 +01:00 committed by GitHub
parent 5c52d4f7f8
commit 48fae59ba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.swp

View file

@ -106,7 +106,11 @@ upower_battery_remaining_time() {
}
acpi_battery_remaining_time() {
acpi -b | grep -m 1 -Eo "[0-9]+:[0-9]+:[0-9]+"
regex="[0-9]+:[0-9]+"
if ! $short; then
regex="$regex:[0-9]+"
fi
acpi -b | grep -m 1 -Eo "$regex"
}
print_battery_remain() {