View Single Post
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#545
I improved the battery script slightly to incorporate the bars to have the same colours as the percentage:
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}} Battery $status % " "{{=0.$status}}"
else if [[ $status -ge 25 && $staus -le 49 ]]
then
echo -n "{{yellow}} Battery $status % " "{{=0.$status}}"
else if [[ $status -le 24 ]]
then 
echo -n "{{red}} Battery $status % " "{{=0.$status}}"
fi
fi
fi

Thanks for the qdbus commands slarti...


Similary for the data to be reflected in coloured bars too:

Code:
#!/bin/sh

# Reflect Data usage or warn if <20% left #

tx=$(gconftool -g /cellui/settings/datacounter/transfer/gprs_home_tx_bytes)
rx=$(gconftool -g /cellui/settings/datacounter/transfer/gprs_home_rx_bytes)
totalMB=$((($tx+$rx)/1000000))
avail=$(gconftool -g /cellui/settings/datacounter/general/gprs_home_notification_period_UI)
availMB=$(($avail/1000000))
usage=$(($totalMB*100/$availMB))
if [ $usage -ge 80 ]
then
echo {{red}}"Data < 20%" "{{=0.$usage}}"
else 
echo {{cyan}}"Data $totalMB MB" "{{=0.$usage}}" 
fi

Last edited by thedead1440; 2013-01-21 at 10:11.
 

The Following User Says Thank You to thedead1440 For This Useful Post: