#! /bin/bash
sudo gainroot
#set variables for current bar level and previous bar level
curlvl=`lshal|grep percentage|tr -s " "|cut -d " " -f 4|sort -n|head -1`
echo $curlvl
#set pattern to current battery level
poff="com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate string:Pattern"
pon="com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate string:Pattern"
case ${curlvl} in
[0-9]|1[0-9])color="red";;
[2-3][0-9])color="purple";;
[4-5][0-9])color="yellow";;
[6-7][0-9])color="bblue";;
*)color="white";;
esac
for somecolor in "white" "bblue" "yellow" "purple" "red"; do
finaldestination="$poff$somecolor"
[ "$color" = "$somecolor" ] && finaldestination="$pon$somecolor"
dbus-send --system --type=method_call --dest=$finaldestination
done
exit
case `lshal|grep percentage|tr -s " "|cut -d " " -f 4|sort -n|head -1` in
[0-9]|1[0-9])color="red";; [2-3][0-9])color="purple";; [4-5][0-9])color="yellow";; [6-7][0-9])color="bblue";; *)color="white";;

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

[0-9]|1[0-9])color="red";; [2-3][0-9])color="purple";; [4-5][0-9])color="yellow";; [6-7][0-9])color="bblue";; *)color="white";;
s1="com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_led_pattern_" s3="activate string:Pattern" case `lshal|grep percentage|tr -s " "|cut -d " " -f 4|sort -n|head -1` in [0-9]|1*)color=red;; [2-3]*)color=purple;; [4-5]*)color=yellow;; [6-7]*)color=bblue;; *)color=white;;esac; for somecolor in white bblue yellow purple red; do [ "$color" = "$somecolor" ] && s2="" || s2="de" todo="$s1$s2$s3$somecolor" dbus-send --system --type=method_call --dest=$todo done exit
| The Following User Says Thank You to blue_led For This Useful Post: | ||
