Change battery labels
This commit is contained in:
parent
ad6dcb29c2
commit
bd39d8af10
2 changed files with 30 additions and 14 deletions
|
@ -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
|
||||
|
@ -27,5 +37,5 @@ elif upower -d | grep '\bdischarging\b' >/dev/null 2>&1; then
|
|||
fi
|
||||
echo "${icon} ${percent}% (${remaining})"
|
||||
else
|
||||
echo ""
|
||||
echo "${icon}"
|
||||
fi
|
||||
|
|
|
@ -66,12 +66,18 @@ LABEL_IP=<span foreground='#8ccaff'>ﯱ </span>
|
|||
|
||||
[battery]
|
||||
THRESHOLD=10
|
||||
LABEL_FULL=
|
||||
LABEL_75=
|
||||
LABEL_50=
|
||||
LABEL_25=
|
||||
LABEL_EMPTY=
|
||||
LABEL_CHARGING=<span foreground='#8cff8a'> </span>
|
||||
LABEL_100=
|
||||
LABEL_90=
|
||||
LABEL_80=
|
||||
LABEL_70=
|
||||
LABEL_60=
|
||||
LABEL_50=
|
||||
LABEL_40=
|
||||
LABEL_30=
|
||||
LABEL_20=
|
||||
LABEL_10=
|
||||
LABEL_ALERT=
|
||||
LABEL_CHARGING=<span foreground='#8cff8a'></span>
|
||||
interval=5
|
||||
|
||||
[calendar]
|
||||
|
|
Loading…
Add table
Reference in a new issue