Przeglądaj źródła

~/.bin/warn-if-low.sh: Support for my new laptop.

I think support for the old one is broken, but for now I don't use it.
Lucas Stadler 12 lat temu
rodzic
commit
9ec8e85649
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      .bin/warn-if-low.sh

+ 3 - 3
.bin/warn-if-low.sh

3
# Warn if the battery status is lower than 10%
3
# Warn if the battery status is lower than 10%
4
4
5
charge_path="/sys/class/power_supply"
5
charge_path="/sys/class/power_supply"
6
charge_full=`cat $charge_path/BAT0/charge_full`
7
charge_now=`cat $charge_path/BAT0/charge_now`
6
charge_full=`cat $charge_path/BAT0/energy_full`
7
charge_now=`cat $charge_path/BAT0/energy_now`
8
charge_rate=$(($charge_now * 100 / $charge_full ))
8
charge_rate=$(($charge_now * 100 / $charge_full ))
9
9
10
online=`cat $charge_path/AC0/online`
10
online=`cat $charge_path/AC/online`
11
11
12
if [ "$online" = "0" -a $charge_rate -lt 10 ]; then
12
if [ "$online" = "0" -a $charge_rate -lt 10 ]; then
13
	DISPLAY=:0 zenity --error --text "Whoopey: You're low on energy (only $charge_rate% left)!"
13
	DISPLAY=:0 zenity --error --text "Whoopey: You're low on energy (only $charge_rate% left)!"