View Single Post
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#662
Originally Posted by IcyAirs View Post
Can someone take a look at this and tell me what I'm doing wrong? Everything pretty much works, except that when I use the widget to turn Off wifi, the button goes dark as expected but then pops back to On (exit code 1?)... wifi shuts down correctly, though, so it isn't really an issue, just something unexpected happening that I'm not sure how to fix.

There's some disabled dbus-monitoring code in there that I wanted to implement for setting the button to off (for when going out of wifi range or auto-disconnect taking down the wlan), but then I realized programs can bring up the connection too, so I just set it to update the status of the button @desktop... workaround, but whatever.

Code:
[queen-beecon-header]
version=1.000000
checksum=5509570
[queen-beecon-exported-instance]
widgetType=0
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=
beecon_eq0_ImgZoom=1
beecon_eq0_BgRGB=3
beecon_eq0_ExtBgRGB=#0000ffff0000
beecon_eq0_ImgFilename=off-button.png
beecon_eq1_ImgZoom=1
beecon_eq1_BgRGB=4
beecon_eq1_ExtBgRGB=#ffff00000000
beecon_eq1_ImgFilename=on-button.png
beecon_ge2_ImgZoom=0
beecon_ge2_BgRGB=5
beecon_ge2_ExtBgRGB=#000000000000
beecon_ge2_ImgFilename=
beecon_idxge2_ImgZoom=0
beecon_idxge2_BgRGB=11
beecon_idxge2_ExtBgRGB=#ffffffffffff
beecon_idxge2_ImgFilename=
widWidth=90.085043988269803
widHeight=90.411764705882348
instanceTitle=Wifi
instanceCmd=if [ "_$QBW_EXEC_REASON" == "_QBW_STARTUP_UPDATE" ];
then\nif [ "_$QBW_IS_CONNECTED" == "_true" ]; then\n  echo "ON";\n
exit 1;\nelse\n  echo "OFF";\n  exit 0;\nfi;\nfi;\n\nif [
"_$QBW_EXEC_REASON" == "_QBW_DESKTOP_SWITCH" ]; then\nif [
"_$QBW_IS_CONNECTED" == "_true" ]; then\n  echo "ON";\n  exit
1;\nelse\n  echo "OFF";\n  exit 0;\nfi;\nfi;\n\nif [
"_$QBW_CURRENT_RESULTS_TEXT" == "_OFF" ]; then\n    dbus-send --system
--type=method_call --dest=com.nokia.icd /com/nokia/icd
com.nokia.icd.connect string:"[ANY]" uint32:0;\n  echo "ON";\n  exit
1;\nfi;\n\nif [ "_$QBW_CURRENT_RESULTS_TEXT" == "_ON" ]; then\n
dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui
com.nokia.icd_ui.disconnect boolean:true;\n  echo "OFF";\n  exit
0;\nfi;
rememberMe=
cmdImgFilename=queen-beecon.png
cmdImgAngle=0
cmdImgZoom=0
cmdFgRGB=1
cmdExtFgRGB=#ffffffffffff
cmdTextAngle=0
cmdVisibilityPosition=0
cmdImgVisibilityPosition=0
cmdJustify=0
cmdExtFont=Nokia Sans bold italic 12
cmdFontName=3
cmdFontSize=12
resImgFilename=queen-beecon-resimg.png
resImgAngle=0
resImgZoom=0
resFgRGB=1
resExtFgRGB=#ffffffffffff
resTextAngle=0
resVisibilityPosition=0
resImgVisibilityPosition=5
resJustify=0
resExtFont=Nokia Sans bold 12
resFontName=2
resFontSize=12
progressAnimationFrames=0
progressAnimationTimer=4
progressAnimationPos=4
progressAnimationAtClickXY=false
progressAnimationBasename=queen-beecon-progress
updOnStartup=true
updOnClick=true
updOnDesktop=true
updOnSight=false
delayIndex=0
customIntervalSecs=0
updNeworkPolicy=0
updOnDBUS=0
updOnDBUSBus=0
updOnDBUSMatchRule=type='signal',path='/com/nokia/wlancond/signal',interface='com.nokia.wlancond.signal',member='disconnected',arg0='wlan0'
edit: I'm not sure how to write the command without the new lines, either... i tried fixing it with ;'s as nononoyes mentioned, but then the widget just gave me error code 2... massive failure. It looks alright in the command buffer, just export changes them all into /n's, which is as expected but still kinda annoying
no need for _$QBW_EXEC_REASON" == "_QBW_DESKTOP_SWITCH", imho

use $QBW_EXEC_REASON==QBW_CLICK to issue connection on/off command according to $QBW_IS_CONNECTED true/false status

use DBUS Monitor with rule:
Code:
type='signal',interface='com.nokia.icd',path='/com/nokia/icd',member='status_changed'
$QBW_EXEC_REASON==QBW_DBUS_MONITOR
to be notified about on/off connection status change (grep $QBW_DBUS_VERBOSE_OUTPUT for "CONNECTED" or else)
This way you can switch icons when connection is already properly setup
__________________
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: