summaryrefslogtreecommitdiff
path: root/ratcpi
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-01-24 15:29:54 +0100
committerPatrick Simianer <p@simianer.de>2015-01-24 15:29:54 +0100
commitb0878f91c4ab2a8a61c524084ac6db702971b426 (patch)
tree747b70537e0a000fbbe649d4e993693db81a6ff8 /ratcpi
parentc60daeb4f53ab0f73991851d65dd51454c8fb064 (diff)
average battery
Diffstat (limited to 'ratcpi')
-rwxr-xr-xratcpi20
1 files changed, 11 insertions, 9 deletions
diff --git a/ratcpi b/ratcpi
index 1ce58d3..ec04c21 100755
--- a/ratcpi
+++ b/ratcpi
@@ -3,6 +3,7 @@
#======================================================
# RatCPI version .10--Power management, Ratpoison style
# By Door
+# edited by pks (average of battery capacities)
#======================================================
## Do you want to be informed of charging status?
@@ -39,16 +40,16 @@ while winsys=$(ps -e | grep ratpoison | wc -l)
charge=$(eval acpi -V|grep charge|wc -l)
never2=$(eval acpi -V|grep never|wc -l)
- lowbatt50=$(eval acpi|grep 50%|wc -l)
- lowbatt25=$(eval acpi|grep 25%|wc -l)
- lowbatt15=$(eval acpi|grep 15%|wc -l)
- lowbatt10=$(eval acpi|grep 10%|wc -l)
- lowbatt5=$(eval acpi|grep \ 5%|wc -l)
- lowbatt3=$(eval acpi|grep \ 3%|wc -l)
- lowbatt1=$(eval acpi|grep \ 1%|wc -l)
+ lowbatt50=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep 50%|wc -l)
+ lowbatt25=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep 25%|wc -l)
+ lowbatt15=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep 15%|wc -l)
+ lowbatt10=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep 10%|wc -l)
+ lowbatt5=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep \ 5%|wc -l)
+ lowbatt3=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep \ 3%|wc -l)
+ lowbatt1=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep \ 1%|wc -l)
- hibat95=$(eval acpi|grep 95%|wc -l)
- hibat75=$(eval acpi|grep 75%|wc -l)
+ hibat95=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep 95%|wc -l)
+ hibat75=$(eval echo "$(acpi|cut -d" " -f4|sed "s|%||"|avg|round 0)%"|grep 75%|wc -l)
if (($charge==1))
then
@@ -129,3 +130,4 @@ fi
sleep $delay
done
+