blob: 7c1d18be292896da3a5f63a480b5111352ff5577 (
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
|
#!/usr/bin/env bash
update() {
id=$1
setup_trap "${id}.*"
while true; do
acpi -bt |
sed -r \
-e 's/^([A-Z])[a-z]+ ([0-9]+):/\1\2:/' \
-e 's/\s*degrees\s*/°/g' \
-e 's/Charging,\s*/↑/g' \
-e 's/Discharging,\s*/↓/g' \
-e 's/Unknown,\s*/?/g' \
-e 's/\s*remaining//g' \
-e 's/\s*until charged//g' \
-e 's/charging at zero rate - will never fully charge./∞/g' \
-e 's/\s*ok,\s*//g' \
-e 's/\s+//g' |
cat -n | while read -r n line; do
printf "label %s\n" "$line" | write "${id}.${n}"
done
sleep 1
done
}
. "$(dirname "$0")/rbar.sh"
|