Notices


Reply
Thread Tools
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#91
corrected & tested.

add word Pattern
convert all variables to strings
corrected IF line


colored lines must be one line

Code:
#! /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
separate set of curlvl is not necessary. evaluation is executed once and it can be in case statement like this ( one line !! )

Code:
case `lshal|grep percentage|tr -s " "|cut -d " " -f 4|sort -n|head -1` in

Last edited by blue_led; 2010-11-12 at 23:28.
 
Posts: 429 | Thanked: 217 times | Joined on Apr 2010 @ Dubai
#92
there is something i dont get...
what does this mean?
Code:
[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";;
__________________
N900 @850Mhz
My N900 changed my life and made it ALOT easier!
 
Posts: 68 | Thanked: 20 times | Joined on Jan 2010 @ Chicago
#93
I tried this with Desktop command widget. I don't think this is a good idea. I selected the command preset for Battery %, and replaced it with your 5 color script.
When I saved the script for the widget Hildon desktop froze, and most of my desktop items disappeared.
I restarted the phone, and was unable to access the menu to add & remove desktop items. So I uninstalled Desktop Command Widget and istalled Queen Beecon instead, which work just fine.

The only trouble is that if I try to reinstall Desktop Command Execution Widget it is not functional, so I'm pretty sure there are some config files left in the system that need to be cleaned out-I just don't know how to find them.
 
Posts: 429 | Thanked: 217 times | Joined on Apr 2010 @ Dubai
#94
i feared that would happen
and yes you are right the file for the config is there and you must delete it
im not sure where it is located so i cant advice you on that matter
i dont see a reason for you to install it back again
QBW is much much better
it has much more options than the DCEW
__________________
N900 @850Mhz
My N900 changed my life and made it ALOT easier!
 
Posts: 92 | Thanked: 9 times | Joined on Apr 2010
#95
Originally Posted by bakuur View Post
thanks alot mate
im glad you liked it
error fixed XD
My Pleasure
 

The Following User Says Thank You to xperto For This Useful Post:
Posts: 35 | Thanked: 4 times | Joined on Jul 2008 @ São Paulo-Brasil
#96
hi, does this application works on n810?
 
Posts: 429 | Thanked: 217 times | Joined on Apr 2010 @ Dubai
#97
Originally Posted by Angelochelotti View Post
hi, does this application works on n810?
i dont think so, well am not sure if it uses the same configuration

can you change the LED color of lets say the sms? if so, then tell me how

as by doing so i may determine whether it will work on the N810
__________________
N900 @850Mhz
My N900 changed my life and made it ALOT easier!
 
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#98
Originally Posted by bakuur View Post
there is something i dont get...
what does this mean?
Code:
[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";;
[0-9] mean first char 0 ,..., 9
| mean OR
1[0-9] mean 10, ...., 19
[2-3][0-9] mean first char 2 or 3 and second char any from 0,1,2,...,9
* = any string

another functional case choices could be:

[0-9]|1*)color="red";;
[2-3]*)color="purple";; /* mean any string starting with "2" or "3" */
[4-5]*)color="yellow";;
[6-7]*)color="bblue";;
*)color="white";;



http://docstore.mik.ua/orelly/unix/upt/ch44_05.htm
http://docstore.mik.ua/orelly/unix/upt/ch44_06.htm

my last variant of 5 color script
Code:
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

Last edited by blue_led; 2010-11-15 at 21:52.
 

The Following User Says Thank You to blue_led For This Useful Post:
Posts: 429 | Thanked: 217 times | Joined on Apr 2010 @ Dubai
#99
thanks alot for the hard work mate
test and will upload soon enough
__________________
N900 @850Mhz
My N900 changed my life and made it ALOT easier!
 
Reply

Tags
bakuur, battery, indicator, notification


 
Forum Jump


All times are GMT. The time now is 23:14.