-
Notifications
You must be signed in to change notification settings - Fork 0
/
battery.sh
71 lines (66 loc) · 1.75 KB
/
battery.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
[ "$UID" -eq 0 ] || exec sudo "$0" "$@"
carga=$(cat /sys/class/power_supply/BAT*/capacity)
echo ""
echo "***Bateria IdeaPad***"
echo "***Carga atual $carga%***"
if grep -q 1 /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode;
then
echo ""
echo "MODO DE CONSERVAÇÃO HABILITADO."
echo ""
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to\ full|capacity|voltage"
fi
if grep -q 0 /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode;
then
echo ""
echo "MODO DE CONSERVAÇÃO DESABILITADO."
fi
echo ""
echo "1) Habilitar modo de conservação"
echo "2) Desabilitar modo de conservação"
echo "3) Status da bateria"
echo "4) Sair"
echo ""
read sw
if [ $sw -eq 1 ]
then
echo 1 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
echo ""
echo "Modo de conservação habilitado."
echo " :) Enjoy"
echo ""
fi
if [ $sw -eq 2 ]
then
echo 0 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
echo ""
echo "Modo de conservação desabiltado."
echo "Take Easy"
echo ""
fi
if [ $sw -eq 3 ]
then
if grep -q 1 /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode;
then
echo ""
echo "MODO DE CONSERVAÇÃO HABILITADO. << $carga% >>"
echo ""
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to\ full|capacity|voltage"
fi
if grep -q 0 /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode;
then
echo ""
echo "MODO DE CONSERVAÇÃO DESABILITADO. << $carga% >>"
echo ""
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to\ full|capacity|voltage"
fi
fi
if [ $sw -eq 4 ]
then
echo
echo ""
echo "Sair"
echo "***Carga atual $carga%***"
echo ""
fi