scripts

unixus scriptus
git clone https://s.sonu.ch/~roket1428/scripts.git
Log | Files | Refs

commit 700ada53c2db02aa1b94da717e614399d0deed8d
parent d08d450efac63e9fcc558a04351ca46ddce2b7ad
Author: roket1428 <meorhan@protonmail.com>
Date:   Sun,  5 Sep 2021 21:48:54 +0300

rewrote bat script

Diffstat:
Mbat | 16+++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/bat b/bat @@ -1,17 +1,11 @@ #!/bin/sh -# OpenBSD -# show remaining battery capacity (very system specific) +# show remaining battery -bat0full=$(sysctl -n hw.sensors.acpibat0 | sed -ne 's/\ .*//;4p') -bat0now=$(sysctl -n hw.sensors.acpibat0 | sed -ne 's/\ .*//;7p') -bat0cap=$(echo "100 * (${bat0now} / ${bat0full})" | bc -l) +bat=$(apm -l) -bat0=$(sysctl -n hw.sensors.acpibat0 | sed -ne 's/\ .*//;9p') - - -if [ "${bat0}" -eq "2" ]; then - printf "%0.f%%+\\n" "$bat0cap" # charging: 50%+ +if [ "$(apm -b)" -eq "3" ]; then + printf "%s%%+\\n" "$bat" else - printf "%0.f%%\\n" "$bat0cap" # discharging: 50% + printf "%s%%\\n" "$bat" fi