summaryrefslogtreecommitdiff
path: root/batterylow
blob: cf081d1cf95a42137a99aba528229972e07936ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

# those variables may be unnecessary
export DISPLAY=:0
export HOME=/home/filipek

percentage=$(upower -i "$(upower -e | grep BAT)" |
    awk '/percentage/ {gsub(/%/, "", $2); print $2}')

if [ "$percentage" -le 5 ]; then
    notify-send "Battery very low."
elif [ "$percentage" -ge 14 ] && [ "$percentage" -le 15 ]; then
    notify-send "Battery low."
fi