星期一, 6月 15, 2009

Change wireless on/off status in general user mode

list some different ways, but need to verify by yourself carefully.

1. silly way....killall nm-applet

2. /etc/acpi/wireless.sh

3. script file by Paul Liu
For old/new version (remark lines are for old version)
#!/bin/sh

#dbus-send --system --type=method_call \
# --dest=org.freedesktop.NetworkManager \
# /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.setWirelessEnabled \
# boolean:false

#dbus-send --system --print-reply --type=method_call \
# --dest=org.freedesktop.NetworkManager \
# /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.getWirelessEnabled

STAT=`dbus-send --system --print-reply --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.DBus.Properties.Get \
string:org.freedesktop.NetworkManager \
string:WirelessEnabled | grep variant | awk '{ print $3 }'`
case "$STAT" in
true)
NEWSTAT="false"
;;
*)
NEWSTAT="true"
;;
esac
dbus-send --system --type=method_call \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.DBus.Properties.Set \
string:org.freedesktop.NetworkManager \
string:WirelessEnabled variant:boolean:$NEWSTAT

沒有留言: