View Single Post
Posts: 156 | Thanked: 90 times | Joined on Jan 2010
#160
Sorry for double post, but it's totally different issue, so I figured it would be ok to put it in own post. So, I tried to write a command for Desktop Command Execution widget to disable Wi-Fi (like "Wifi switcher"). It unloads the modules and disables Wi-Fi. The script, which I extracted from Wifi switcher looks:

Code:
#!/bin/sh
out=`ifconfig wlan0`
if [ $? -eq "0" ] ; then
if [ `echo "$out" | grep -c RUNNING` -gt "0" ] ; then
run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
fi
ifconfig wlan0 down
rmmod wl12xx
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Wi-Fi disabled'
exit 2
else
modprobe wl12xx
wl1251-cal
stop wlancond
start wlancond
ifconfig wlan0 up
run-standalone.sh dbus-send --print-reply --system --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false
exit 0
fi
And it works if run from terminal with "sh script.sh". But when I configure DCE command:

sh /path/to/script.sh | echo ""

And click the widget only line which shows connect menu gets executed (at least that's only visible change).

So, what is the issue?



Also, to contribute a little, here are scripts to be put in DCE to (one line each):

- Disconnect internet:
Code:
dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true; dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Internet disconnected'; echo ""
- Connect internet (show connections):
Code:
dbus-send --print-reply --system --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false | echo ""