maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread (https://talk.maemo.org/showthread.php?t=45388)

low 2013-05-25 17:29

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
1 Attachment(s)
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

Alecsandru 2013-08-11 04:36

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
has anyone succesfully created a media player widget with queen beacon?

som3a 2014-02-03 15:43

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
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 !! :/

No!No!No!Yes! 2014-02-03 15:56

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
WIKI and Examples can be a good start.

som3a 2014-02-03 17:22

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
greattttt :) ,, i will be digging there :)

and about the password lock thing !!!

Whispering Weasel 2014-04-20 21:26

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
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 ? :)

No!No!No!Yes! 2014-04-21 20:16

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
Quote:

Originally Posted by Whispering Weasel (Post 1422123)
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

Whispering Weasel 2014-04-24 10:45

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
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



No!No!No!Yes! 2014-04-25 19:03

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
Quote:

Originally Posted by Whispering Weasel (Post 1422564)
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

Whispering Weasel 2014-04-27 20:15

Re: [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread
 
1 Attachment(s)
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)


All times are GMT. The time now is 18:23.

vBulletin® Version 3.8.8