Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    [ANNOUNCED] LED-Battery Indicator -Major Update

    Reply
    Page 10 of 10 | Prev |   8     9   10 |
    blue_led | # 91 | 2010-11-12, 22:44 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by blue_led; 2010-11-12 at 23:28.

     
    bakuur | # 92 | 2010-11-13, 08:31 | Report

    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";;

    Edit | Forward | Quote | Quick Reply | Thanks

     
    jr1415us | # 93 | 2010-11-13, 17:52 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    bakuur | # 94 | 2010-11-13, 18:29 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    xperto | # 95 | 2010-11-13, 21:12 | Report

    Originally Posted by bakuur View Post
    thanks alot mate
    im glad you liked it
    error fixed XD
    My Pleasure

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to xperto For This Useful Post:
    bakuur

     
    Angelochelotti | # 96 | 2010-11-13, 22:01 | Report

    hi, does this application works on n810?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    bakuur | # 97 | 2010-11-13, 22:06 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    blue_led | # 98 | 2010-11-15, 21:08 | Report

    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

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by blue_led; 2010-11-15 at 21:52.
    The Following User Says Thank You to blue_led For This Useful Post:
    bakuur

     
    bakuur | # 99 | 2010-11-16, 08:10 | Report

    thanks alot for the hard work mate
    test and will upload soon enough

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 10 of 10 | Prev |   8     9   10 |
vBulletin® Version 3.8.8
Normal Logout