summaryrefslogtreecommitdiff
path: root/.config/wmii-hg/rbar_acpi
blob: 634887354d178a1893ba4667aa8b08c628682812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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' |
		    cat -n | while read -r n line; do
				     printf "label %s\n" "$line" | write "${id}.${n}"
			     done
		sleep 1
	done
}

. "$(dirname "$0")/rbar.sh"