View Single Post
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#539
How did I miss the {{=decimal}} tag!?

I was just about to start learning how to draw stuff with python but this makes things a "little" easier.

win7mac's script with a couple of tweaks (I didn't bother with the 100% special case because my device never shows 100%):

Code:
#!/bin/sh
status=$(qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/bme org.freedesktop.Hal.Device.GetProperty battery.charge_level.percentage)
if [[ $status -ge 50 ]]
then echo -n "{{green}} $status % {{=0.$status}}"
fi
if [[ $status -ge 25 && $status -le 49 ]]
then echo -n "{{yellow}} $status % {{=0.$status}}"
fi
if [[ $status -le 24 ]]
then echo -n "{{red}} $status % {{=0.$status}}"
fi

Last edited by slarti; 2013-01-19 at 19:30.