View Single Post
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#723
Originally Posted by slarti View Post
Ok, you shouldn't put the tag in to the script but you should call the script with it.
{cell-signal-strength?{script: sh signalbar.sh}}
This ties the execution of the script to changes in the property.
The $percent variable in your script has the exact same value as the {cell-signal-strentgh} property at that time, so use that.
This works partial. I can't get the " %" after $percent to show up and when I switch on flightmode it breaks the script and nothing is shown except "}".

Here's my actual script:
Code:
#!/bin/sh

percent=$(qdbus --system com.nokia.csd /com/nokia/csd/csnet com.nokia.csd.CSNet.SignalStrength.SignalPercent)
if [[ $percent -eq -1 ]]
then echo -n "{{red}}Flugmodus an ✈"
else if [[ $percent -ge 20 ]]
then printf "{{yellow}}{{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}} $percent %"
else if [[ $percent -le 19 ]]
then printf "{{red}}{{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}} $percent %"
fi
fi
fi
__________________
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