Notices


Reply
Thread Tools
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#541
Originally Posted by coderus View Post
@slarti you missed 100%
Yeah, I know. I never get a 100% so I didn't bother. If someones bar is green when showing just a little bit of bar and it bothers him/her, code the special case yourselves...
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#542
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}}"
fi
if [[ $status -ge 25 && $status -le 49 ]]
then echo -n "{{yellow}}"
fi
if [[ $status -le 24 ]]
then echo -n "{{red}}"
fi
echo -n " $status % "
if [[ $status -eq 100 ]]
then echo -n "{{=1.0}}"
else echo -n "{{=0.$status}}"
fi
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 2 Users Say Thank You to coderus For This Useful Post:
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#543
OMG, I missed some lines... Was in a rush, sorry. Fixed now.
Thanks for taking the challenge and taking this to perfectionism.

Keep 'em coming...
[Edit]Like percentage for WLAN signal strength?
__________________
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-01-20 at 21:05.
 
Posts: 63 | Thanked: 75 times | Joined on Jul 2012 @ Austria
#544
Or what about the connection mode (2G / 3G)?
 
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:
Posts: 239 | Thanked: 70 times | Joined on Oct 2010 @ Germany
#546
hello,

i would like to know if it's possible to add another feature or edit a feature.
when i use upcoming events, it shows the upcoming events in this week i guess...
but i think it doesn't look good like it is now.
for example +1 09:00 ...
would prefere if it shows the short version of the day... like Thu 09:00
 
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#547
snooky, use the *Ultimate Customizable Event Attribute Getter*™ by slarti:
https://github.com/harmattan/billboa...vent_lister.py
__________________
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
 

The Following User Says Thank You to Win7Mac For This Useful Post:
Posts: 239 | Thanked: 70 times | Joined on Oct 2010 @ Germany
#548
lol looks way to complicated for me but thank you
 
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#549
I put together this script for signal strength, which works fine most the time.
But sometimes I see the attached screen - how is it possible?
Code:
#!/bin/sh

percent=$(qdbus --system com.nokia.csd /com/nokia/csd/csnet com.nokia.csd.CSNet.SignalStrength.SignalPercent)
if [[ $percent -ge 25 ]]
then
echo -n "{{yellow}} $percent % " "{{=0.$percent}}"
else if [[ $percent -le 24 ]]
then 
echo -n "{{red}} $percent % " "{{=0.$percent}}"
fi
fi
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
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#550
You missed the 100% like coderus so correctly corrected me.

Your script is printing

Code:
{{yellow}} 100% {{=0.100}}
when the signal strength is a 100%.

You'll have to handle this special case like coderus shows here.

Code:
if [[ $status -eq 100 ]]
then echo -n "{{=1.0}}"
else echo -n "{{=0.$status}}"
fi

Last edited by slarti; 2013-01-24 at 21:37.
 

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


 
Forum Jump


All times are GMT. The time now is 03:52.