View Single Post
low's Avatar
Posts: 36 | Thanked: 57 times | Joined on Jun 2012
#1381
Hi guys,

today I sat down to build something from QBW...
basically it's a text clock telling the time, which also says the time via espeak when clicked and opens the clock app when double clicked.
I am using a font from the Resident Evil theme, and espeak obviously:

Code:
[queen-beecon.desktop-2]
widgetType=1
widgetVisible=1
operationalStatus=0
hideCanvas=true
hideClickCanvas=true
snippetBgRGB=0
snippetExtBgRGB=#000000000000
beecon_lt0_ImgZoom=0
beecon_lt0_BgRGB=2
beecon_lt0_ExtBgRGB=#808080808080
beecon_lt0_ImgFilename=queen-beecon-syserr.png
beecon_eq0_ImgZoom=0
beecon_eq0_BgRGB=3
beecon_eq0_ExtBgRGB=#0000ffff0000
beecon_eq0_ImgFilename=queen-beecon-appok.png
beecon_eq1_ImgZoom=0
beecon_eq1_BgRGB=4
beecon_eq1_ExtBgRGB=#ffffffff0000
beecon_eq1_ImgFilename=queen-beecon-appwrn.png
beecon_ge2_ImgZoom=0
beecon_ge2_BgRGB=5
beecon_ge2_ExtBgRGB=#ffff00000000
beecon_ge2_ImgFilename=queen-beecon-apperr.png
beecon_idxge2_ImgZoom=0
beecon_idxge2_BgRGB=11
beecon_idxge2_ExtBgRGB=#0000ffffffff
beecon_idxge2_ImgFilename=queen-beecon-index.png
widWidth=420.69480519480516
widHeight=200.252427184466
instanceTitle=textclock
instanceCmd=/usr/local/bin/textclock $QBW_EXEC_REASON $QBW_CLICKS_COUNT
rememberMe=
cmdImgFilename=
cmdImgAngle=0
cmdImgZoom=1
cmdFgRGB=1
cmdExtFgRGB=#ffffffffffff
cmdTextAngle=0
cmdVisibilityPosition=0
cmdImgVisibilityPosition=0
cmdJustify=0
cmdExtFont=Nokia Sans bold italic 12
cmdFontName=3
cmdFontSize=12
resImgFilename=
resImgAngle=0
resImgZoom=0
resFgRGB=1
resExtFgRGB=#000000000000
resTextAngle=0
resVisibilityPosition=5
resImgVisibilityPosition=0
resJustify=2
resExtFont=Resident Evil 60
resFontName=16
resFontSize=10
resWrapLongLines=true
progressAnimationFrames=0
progressAnimationTimer=4
progressAnimationPos=4
progressAnimationAtClickXY=false
progressAnimationBasename=
updOnStartup=true
updOnClick=true
multiClick=true
updOnDesktop=true
updOnSight=true
updOnOrientation=false
delayIndex=9
customIntervalSecs=10
updNeworkPolicy=0
GPSsettings=0
updOnDBUS=0
updOnDBUSBus=0
updOnDBUSMatchRule=
And the shellscript to feed the clock:

Code:
if [ "$1" == "QBW_CLICK" ] && [ $2 -eq 2 ] 
then
dbus-send --type=method_call --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:"worldclock"
fi
	h=`date +%-I`
	m=`date +%-M`


k="one:two:three:four:five:six:seven:eight:nine:ten:eleven:twelve:thirteen:fourteen:quarter:sixteen:seventeen:eighteen:nineteen:twenty"
l="x:twenty:thirty:forty:fifty"


if [ $m -lt 21 ] && [ $m -gt 0 ] || [ $m -eq 30 ]
then

	if [ $m -eq 30 ]
	then
		mw="half"	
		
	else
		mw=`echo $k|cut -f$m -d:`
	fi
	hw=`echo $k|cut -f$h -d:`
	o1=$mw
	o2="past"
	o3=$hw
elif [ $m -gt 49 ] || [ $m -eq 45 ] || [ $m -eq 40 ]
then
	
	if [ $h -eq 12 ]
	then
		hw="one"
	else
		h=$(($h+1))
		hw=`echo $k|cut -f$h -d:`
	fi
	m=$((60-$m))
	mw=`echo $k|cut -f$m -d:` 
	o1=$mw
	o2="to"
	o3=$hw
elif [ $m -eq 0 ]
then

	o1=`echo $k|cut -f$h -d:`
	o2="o'clock"
	o3="sharp"

else

	hw=`echo $k|cut -f$h -d:`
	m1=`echo $m|cut -c1`
	m2=`echo $m|cut -c2`
		

	o1=$hw
	o2=`echo $l|cut -f$m1 -d:`
	o3=`echo $k|cut -f$m2 -d:`
fi 
if [ $2 -eq 1 ]
then
	sil=`dbus-send --print-reply --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.get_profile|tail -1|cut -f2 -d\"`
	if [ "$sil" == "silent" ]
	then
	dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Sorry I'm supposed to be silent."
	else
		espeak "$o1 $o2 $o3"
	fi
fi
	echo "$o1<span size=\"1\"> </span><span face=\"NewTimes\" size=\"80000\" weight=\"normal\">$o2</span><span size=\"1\"> </span>$o3"
I hope you enjoy it as much as I do, and of course if you would like to point me to an improvement feel free to drop me a line.

Kind regards,

Sarah
Attached Images
 

Last edited by low; 2013-05-31 at 10:37. Reason: forty not fourty... that happens when you never write out numbers anymore
 

The Following 10 Users Say Thank You to low For This Useful Post: