summaryrefslogtreecommitdiff
path: root/.config/i3blocks/i3_battery.sh
blob: 97ea49345f5722514f52be94d4cdc4da298a9bef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

BAT=$(acpi -b | grep -E -o '[0-9][0-9]?%')
CHECK_CHARGING=$(acpi -b | grep -E -o 'Charging')

# Full and short texts
echo "Battery: $BAT"
echo "BAT: $BAT"

if [ "$CHECK_CHARGING" != "" ]; then
    echo "#1abc9c"
    exit 0
fi
# Set urgent flag below 5% or use orange below 20%
[ ${BAT%?} -le 5 ] && exit 33
[ ${BAT%?} -le 35 ] && echo "#d35400"

exit 0