get paid to paste

RE:#a966c8

status() {
	SIGLEV=$(iwconfig wlan0 | grep 'Signal level')
	if [ "$?" = "0" ]; then
		SIGLEV=$(echo -n "$SIGLEV" | sed -n 's:.*Signal level=\(.* dBm\).*:\1:p')
	else
		SIGLEV=' - '
	fi
	BATT=$(acpi --battery | awk -F ', ' '{print $2}' | sed 's:\(.*\)%:\1:')
	
	echo -n '<'"$BATT"'%>['$(battbar $BATT)'] wlan0<'"$SIGLEV"'> |' $(uptime | sed 's/.*://; s/,//g') '|' $(date +'%I:%M.%S %a, %d %b %Y')
}



Python Script - battbar
#!/usr/bin/python
import math
import sys
r = float(sys.argv[1]) * 16 / 100
i = int(r)
r -= i
output = unichr(9608) * i
j = int(7*r) + 1
if r > 0.0:
  output += unichr(9616-j)
output += " " * (16-i-int(math.ceil(r)))
print output.encode('utf-8')



Works in cli:
<69%>[&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9615; ] wlan0<-27 dBm>
Fails in statusbar:
[tpimg]http://pandora.simons-rock.edu/~egolds07/sc.png[/tpimg]

Pasted: Jan 22, 2011, 6:02:42 pm
Views: 55