Active Topics

 



Notices


Reply
Thread Tools
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:
Alecsandru's Avatar
Posts: 439 | Thanked: 282 times | Joined on Oct 2012
#1382
has anyone succesfully created a media player widget with queen beacon?
__________________
N900 Beast featuring :
8GB OPTFS@ext4(*performance mount options)
overclock: cpu[125 - 1,150(*VDD1)+Dsp overclock
CSSU-T latest version
 
som3a's Avatar
Posts: 132 | Thanked: 34 times | Joined on May 2011 @ sudan
#1383
hi all ,, i have two questions ,, hope i can find the answers as quick as possible
the first one is :
what the things i need to learn/know to make a nice looking QBW?
and if you pleased tell me where to learn them ! consider me as a complete noob
the second one is :
is it possible to password lock a desktop using the QBWs!!

sorry for my missed up english !! :/

Last edited by som3a; 2014-02-03 at 15:53.
 
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#1384
WIKI and Examples can be a good start.
__________________
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
 

The Following User Says Thank You to No!No!No!Yes! For This Useful Post:
som3a's Avatar
Posts: 132 | Thanked: 34 times | Joined on May 2011 @ sudan
#1385
greattttt ,, i will be digging there

and about the password lock thing !!!
 
Whispering Weasel's Avatar
Posts: 54 | Thanked: 89 times | Joined on May 2011 @ Vlaardingen, Netherlands
#1386
I want to create an icon on the normal desktop for email with an unread email counter and when clicked it should open Claws-mail. The Gmail script from the wiki doesn't seem to work (anymore?)

I have managed to get something with curl in the console using the command from here 9adding -k option but have no idea how and where to fit this as script in qbw.
I think it can be done in a script like mentioned this. but exactly how to do this I don't know
Is this possible? any idea's/help ?
__________________
Weaseling out of things is important to learn ! It's what separates us from the animals,
... except the weasel. (Homer Simpson)
 
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#1387
Originally Posted by Whispering Weasel View Post
I want to create an icon on the normal desktop for email with an unread email counter and when clicked it should open Claws-mail. The Gmail script from the wiki doesn't seem to work (anymore?)

I have managed to get something with curl in the console using the command from here 9adding -k option but have no idea how and where to fit this as script in qbw.
I think it can be done in a script like mentioned this. but exactly how to do this I don't know
Is this possible? any idea's/help ?
PHP Code:
Nokia-N900-51-1:~# wget -t 1 -T 3 -q -O - 'https://nonono.yes:nononoyes@mail.google.com/mail/feed/atom' --no-check-certificate | awk 'BEGIN{m=2}/<fullcount>.+<\/fullcount>/{gsub(/<[^>]*>/,"",$0);print $1 " New";if($1>0)m=1;else m=0}END{exit m}'
New
Nokia-N900-51-1:~
This is working for me... or you can use any equivalent with curl.

If you have configured the beecon to run both on timer and on click, in your script you might check $QBW_EXEC_REASON for the following strings

if QBW_TIMER_UPDATE then poll gmail (with the command above)
if QBW_CLICK then run Claws-mail per example in here
__________________
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
 

The Following 5 Users Say Thank You to No!No!No!Yes! For This Useful Post:
Whispering Weasel's Avatar
Posts: 54 | Thanked: 89 times | Joined on May 2011 @ Vlaardingen, Netherlands
#1388
Thanks, it is almost working now, I had issues with wget due to @ in the password, solved it..
Now it is only displaying the mailbox_empty.png but it does update the mailcount, simply pasting the command in the script doesn't let it return the correct state?
My programming skills are ehm.. at noob level so i got this far:

PHP Code:
if [ "$QBW_EXEC_REASON== "QBW_TIMER_UPDATE" ]; then
# get the new mail info
wget -t 1 -T 3 ---user=myusername --password=myp@ssword -'https://mail.google.com/mail/feed/atom' --no-check-certificate awk 'BEGIN{m=2}/<fullcount>.+<\/fullcount>/{gsub(/<[^>]*>/,"",$0);print $1 " New";if($1>0)m=1;else m=0}END{exit m}'
fi;

if [ 
"$QBW_EXEC_REASON== "QBW_CLICK" ]; then
# start claws-mail 
/usr/bin/dbus-send --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:claws-mail
fi

__________________
Weaseling out of things is important to learn ! It's what separates us from the animals,
... except the weasel. (Homer Simpson)
 

The Following User Says Thank You to Whispering Weasel For This Useful Post:
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#1389
Originally Posted by Whispering Weasel View Post
Thanks, it is almost working now, I had issues with wget due to @ in the password, solved it..
Now it is only displaying the mailbox_empty.png but it does update the mailcount, simply pasting the command in the script doesn't let it return the correct state?
My programming skills are ehm.. at noob level so i got this far:

PHP Code:
if [ "$QBW_EXEC_REASON== "QBW_TIMER_UPDATE" ]; then
# get the new mail info
wget -t 1 -T 3 ---user=myusername --password=myp@ssword -'https://mail.google.com/mail/feed/atom' --no-check-certificate awk 'BEGIN{m=2}/<fullcount>.+<\/fullcount>/{gsub(/<[^>]*>/,"",$0);print $1 " New";if($1>0)m=1;else m=0}END{exit m}'
fi;

if [ 
"$QBW_EXEC_REASON== "QBW_CLICK" ]; then
# start claws-mail 
/usr/bin/dbus-send --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:claws-mail
fi

We have a couple of issues here:
First "if block" is missing a piece because awk statement "if($1>0)m=1;else m=0}END{exit m}" just returns the exit code to the calling script... I'd add an explicit exit statement before the fi;

Second "if block" is missing a further check and an exit status; behavior here would be that for every click the beecon will launch the mail program but return a 0 exit and whatever output the dbus-send is issuing to stdout (= always mailbox_empty.png and possibly "" number of messages)

See below for a possible improvement:
PHP Code:
if [ "$QBW_EXEC_REASON== "QBW_TIMER_UPDATE" ]; then
# get the new mail info
wget -t 1 -T 3 ---user=myusername --password=myp@ssword -'https://mail.google.com/mail/feed/atom' --no-check-certificate awk 'BEGIN{m=2}/<fullcount>.+<\/fullcount>/{gsub(/<[^>]*>/,"",$0);print $1 " New";if($1>0)m=1;else m=0}END{exit m}'
exit $?
fi;

if [ 
"$QBW_EXEC_REASON== "QBW_CLICK" ]; then
# start claws-mail 
/usr/bin/dbus-send --dest=com.nokia.HildonDesktop.AppMgr /com/nokia/HildonDesktop/AppMgr com.nokia.HildonDesktop.AppMgr.LaunchApplication string:claws-mail
# get the new mail info
wget -t 1 -T 3 ---user=myusername --password=myp@ssword -'https://mail.google.com/mail/feed/atom' --no-check-certificate awk 'BEGIN{m=2}/<fullcount>.+<\/fullcount>/{gsub(/<[^>]*>/,"",$0);print $1 " New";if($1>0)m=1;else m=0}END{exit m}'
exit $?
fi
Further, you might want to manage possible error conditions from the wget command inside your awk 1-liner
__________________
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
 

The Following 2 Users Say Thank You to No!No!No!Yes! For This Useful Post:
Whispering Weasel's Avatar
Posts: 54 | Thanked: 89 times | Joined on May 2011 @ Vlaardingen, Netherlands
#1390
hmm, I'm not sure about the mailcheck when clicked, it is supposed to just open claws so just an exit 0 would be ok here I think? (displaying mailbox_empty.png until the next timed update).
The problem I'm having is it always seems returns 0 thus displaying mailbox_empty.png although I do get the new mail count.
(mailbox_full.png does work when i change the exit 0 to exit 1)
Attached Images
 
__________________
Weaseling out of things is important to learn ! It's what separates us from the animals,
... except the weasel. (Homer Simpson)
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:45.