diff --git a/roles/i3/files/battery b/roles/i3/files/battery
index 808268e..32f2343 100755
--- a/roles/i3/files/battery
+++ b/roles/i3/files/battery
@@ -1,6 +1,6 @@
#!/bin/bash
-icon="${LABEL_FULL}"
+icon="${LABEL_100}"
percent="$(upower -d | awk '/percentage/ {print $2}' | head -n 1 | cut -d% -f1)"
remaining="$(upower -d | awk -F: '/time to empty/ {print $2}' | awk '{print $1,$2}' | head -n 1)"
@@ -9,15 +9,25 @@ if upower -d | grep '\bcharging\b' >/dev/null 2>&1; then
icon="${LABEL_CHARGING}"
echo "${icon} ${percent}%"
elif upower -d | grep '\bdischarging\b' >/dev/null 2>&1; then
- if [ "$percent" -lt 25 ]; then
- icon="${LABEL_25}"
+ if [ "$percent" -lt 10 ]; then
+ icon="${LABEL_10}"
+ elif [ "$percent" -lt 20 ]; then
+ icon="${LABEL_20}"
+ elif [ "$percent" -lt 30 ]; then
+ icon="${LABEL_30}"
+ elif [ "$percent" -lt 40 ]; then
+ icon="${LABEL_40}"
elif [ "$percent" -lt 50 ]; then
icon="${LABEL_50}"
- elif [ "$percent" -lt 75 ]; then
- icon="${LABEL_75}"
+ elif [ "$percent" -lt 70 ]; then
+ icon="${LABEL_70}"
+ elif [ "$percent" -lt 80 ]; then
+ icon="${LABEL_80}"
+ elif [ "$percent" -lt 90 ]; then
+ icon="${LABEL_90}"
fi
if [ "$percent" -lt "$THRESHOLD" ]; then
- icon="${LABEL_EMPTY}"
+ icon="${LABEL_ALERT}"
notify-send "CHARGE BATTERY"
for file in /dev/pts/*; do
if [ "$(ls -l "$file" | awk '{print $5}')" = '136,' ]; then
@@ -25,7 +35,7 @@ elif upower -d | grep '\bdischarging\b' >/dev/null 2>&1; then
fi
done
fi
- echo "${icon} ${percent}% (${remaining})"
+ echo "${icon} ${percent}% (${remaining})"
else
- echo ""
+ echo "${icon}"
fi
diff --git a/roles/i3/files/i3blocksconfig b/roles/i3/files/i3blocksconfig
index 8af01c0..215e614 100644
--- a/roles/i3/files/i3blocksconfig
+++ b/roles/i3/files/i3blocksconfig
@@ -66,12 +66,18 @@ LABEL_IP=ﯱ
[battery]
THRESHOLD=10
-LABEL_FULL=
-LABEL_75=
-LABEL_50=
-LABEL_25=
-LABEL_EMPTY=
-LABEL_CHARGING=
+LABEL_100=
+LABEL_90=
+LABEL_80=
+LABEL_70=
+LABEL_60=
+LABEL_50=
+LABEL_40=
+LABEL_30=
+LABEL_20=
+LABEL_10=
+LABEL_ALERT=
+LABEL_CHARGING=
interval=5
[calendar]