summaryrefslogtreecommitdiff
path: root/.config/wmii-hg/rbar_acpi
blob: bdcdf0fb4cd395d45ec4b333be250ef552f55470 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/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"