View Single Post
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#740
Many thanks again slarti!
I messed around with the scripts and icons and now have colored, dynamically changing icons for cell- and data-info and battery.
It looks like this now:






For everybody interested, I uploaded the icons to my dropbox: https://www.dropbox.com/sh/ry67p8djb4hidcy/tbRlrVTWQd
If you want other icons, different colors or sizes feel free to ask here or pm me.

Here're the scripts:

signalbar.sh:
Code:
#!/bin/sh

percent=$(qdbus --system com.nokia.csd /com/nokia/csd/csnet com.nokia.csd.CSNet.SignalStrength.SignalPercent)
tech=$(qdbus --system com.nokia.csd.CSNet /com/nokia/csd/csnet com.nokia.csd.CSNet.RadioAccess.Technology)
if [[ $percent -ge 20 && $tech == "GSM" ]]
then echo -n "{{yellow}}$percent % {{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-gsm-yellow.png>>"
else if [[ $percent -le 19 && $tech == "GSM" ]]
then echo -n "{{red}}$percent % {{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-gsm-red.png>>"
fi
fi
if [[ $percent -ge 20 && $tech == "UMTS" ]]
then echo -n "{{yellow}}$percent % {{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-3g-yellow.png>>"
else if [[ $percent -le 19 && $tech == "UMTS" ]]
then echo -n "{{red}}$percent % {{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-3g-red.png>>"
fi
fi
data-mode.sh:
Code:
#!/bin/sh

DT=$(qdbus --system com.nokia.csd.CSNet /com/nokia/csd/csnet com.nokia.csd.CSNet.RadioAccess.DataTechnology)
NT=$(qdbus --system com.nokia.icd2.context /org/maemo/contextkit/Internet/NetworkType org.maemo.contextkit.Property.Get | sed q)
wlan='<</usr/share/themes/blanco/meegotouch/icons/icon-s-status-wlan-cyan.png>>'
umts='<</usr/share/themes/blanco/meegotouch/icons/icon-s-status-3g-yellow.png>>'
egprs='<</usr/share/themes/blanco/meegotouch/icons/icon-s-status-25g-yellow.png>>'
gprs='<</usr/share/themes/blanco/meegotouch/icons/icon-s-status-gsm-red.png>>'
hspa='<</usr/share/themes/blanco/meegotouch/icons/icon-s-status-35g-green.png>>'
if [ $NT == "WLAN" ]
then echo -n $wlan
else if [ $DT == "GPRS" ]
then echo -n $gprs
else if [ $DT == "EGPRS" ]
then echo -n $egprs
else if [ $DT == "UMTS" ]
then echo -n $umts
else if [ $DT == "HSPA" ]
then echo -n $hspa
fi
fi
fi
fi
fi
battery.sh:
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 -eq 100 ]]
then echo -n "{{green}}$status % {{=1.0}}"
fi
if [[ $status -ge 80 && $status -le 99 ]]
then echo -n "{{green}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery8-green.png>>"
fi
if [[ $status -ge 70 && $status -le 79 ]]
then echo -n "{{green}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery7-green.png>>"
fi
if [[ $status -ge 60 && $status -le 69 ]]
then echo -n "{{green}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery6-green.png>>"
fi
if [[ $status -ge 50 && $status -le 59 ]]
then echo -n "{{green}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery5-green.png>>"
fi
if [[ $status -ge 40 && $status -le 49 ]]
then echo -n "{{green}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery4-green.png>>"
fi
if [[ $status -ge 30 && $status -le 39 ]]
then echo -n "{{yellow}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery3-yellow.png>>"
fi
if [[ $status -ge 20 && $status -le 29 ]]
then echo -n "{{yellow}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery2-yellow.png>>"
fi
if [[ $status -ge 10 && $status -le 19 ]]
then echo -n "{{red}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery1-red.png>>"
fi
if [[ $status -ge 1 && $status -le 9 ]]
then echo -n "{{red}}$status % {{=$(($status/100)).$((($status%100)/10))$(($status%10))}} <</usr/share/themes/blanco/meegotouch/icons/icon-s-status-battery-low-red.png>>"
fi
The battery script can be shortened, I guess.

My remaining issues:
- {cell-signal-strength?{script: develsh signalbar.sh}}{{red}}{cell-signal-strength!Flugmodus an ✈} and
{{red}}{cell-signal-strength!Flugmodus an ✈}{cell-signal-strength?{script: develsh signalbar.sh} gives a "}" only when in flightmode

- {network-name}{network-name? {script: develsh /home/user/data-mode.sh}} also gives a "}" only when no network present

- <</usr/share/...path-to-icon.png>> won't show up if put in BB directly or in python scripts, only from shell scripts
Probably I'm doing sth wrong, I tried
Code:
print ('{{blue}}'+event_date+' '+event_time+' '+title+' '+<</usr/share/themes/blanco/meegotouch/icons/icon-s-calendar.png>>)
as the last line in slartis' events.py

- what about emoji icons in python scripts, possible (not really needed if images would work)?

And here's the mess with the brackets when flightmode on and no active network, any solution for this?:
Attached Images
 
__________________
Nokia 5110 > 3310 > 6230 > N70 > N9 BLACK 64GB
Hildon Foundation Board member
Maemo Community e.V. co-creator, founder and director since Q4/2016
Current Maemo Community Council member

Last edited by Win7Mac; 2013-03-26 at 14:38. Reason: added pic
 

The Following 4 Users Say Thank You to Win7Mac For This Useful Post: