commit 2b355e6fa0085e9ef2e1c27e830ac383bc50bea8
parent 9f4ab268bea8802916822a0a69e82d1ad76503ee
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 19 Dec 2018 22:12:10 +0100
Show power draw from battery when unplugged
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/links/.config/i3/i3blocks b/links/.config/i3/i3blocks
@@ -105,7 +105,7 @@ signal=10
[i3battery BAT0]
label=PWR
-interval=30
+interval=10
signal=12
# [i3battery BAT0]
diff --git a/links/.config/i3/i3scripts/i3battery b/links/.config/i3/i3scripts/i3battery
@@ -15,6 +15,7 @@ capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
status=$(cat /sys/class/power_supply/"$1"/status)
time=" ($(acpi -b | egrep -o '[0-9][0-9]:[0-9][0-9]'))"
[ "$time" = " ()" ] && time=""
+powerdraw=" $(( $(cat /sys/class/power_supply/"$1"/power_now)/1000000 ))W"
if [ "$capacity" -ge 80 ]; then
color="#b8bb26"
@@ -33,4 +34,4 @@ fi
[ "$status" = "Charging" ] && color="#FFF"
-printf "<span color='%s'>%s%s%s</span>%s" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$time"
+printf "<span color='%s'>%s%s%s</span>%s" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$time$powerdraw"