Adjust format for acpibat(4) - statusbar - Shell script to set/print a status bar
(HTM) hg clone https://bitbucket.org/iamleot/statusbar
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset 0864cb1a791e76cf9104007e0dd1f3f72390ee25
(DIR) parent d8b8e8fcc7c0e5fc995e2ed4a97b19dc40e17b46
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sat, 11 May 2019 18:21:44
Adjust format for acpibat(4)
Last field is, e.g.: `(12.34%)', remove parenthesis so int() works.
Diffstat:
statusbar.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff -r d8b8e8fcc7c0 -r 0864cb1a791e statusbar.sh
--- a/statusbar.sh Thu May 09 21:26:10 2019 +0200
+++ b/statusbar.sh Sat May 11 18:21:44 2019 +0200
@@ -152,7 +152,7 @@
fi
{ envstat -s "$battery_sensor" || echo "charge: (N/A)" ; } |
awk '/battery percent:/ { printf("%d%%", int($3)) }
- /charge:/ { printf("%s", ($NF == "(N/A)") ? "(N/A)" : int($NF) "%") }'
+ /charge:/ { printf("%s", ($NF == "(N/A)") ? "(N/A)" : int(substr($NF, 2, length($NF))) "%") }'
}
#