blob: 53c1cb0f3acd2ea86943bf8093e729f7c7d52de9 (
plain)
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
|
#!/bin/bash
percent="$(acpi | awk '{print $4}')"
state="$(acpi | awk '{print $3}')"
time="$(acpi | awk '{print $5}')"
state0=""
state1=""
state2=""
state3=""
state4=""
if [[ "$1" = "condition" ]]; then
if ((${percent::-2} <= 10)) ; then
echo "1"
else
echo "0"
fi
exit 0
fi
if [ "${state::-1}" == "Discharging" ]; then
echo "${percent::-1} (${time::-3} ↓)"
else
echo "${percent::-1} (${time::-3} ↑)"
fi
|