View Single Post
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#2
Toggle-LPM

Contents of the sh script:
Code:
~# cat /home/user/.local/share/data/toggle-lpm/toggle-lpm.sh 
#!/bin/sh
# Toggle Low Power Mode (Standby Screen) by thedead1440

STATUS=$(gconftool --get /system/osso/dsm/display/use_low_power_mode)

if [ $STATUS == "true" ]
	then
	gconftool -s --type=bool /system/osso/dsm/display/use_low_power_mode false
	sed -i 's/toggle\-lpm\-on/toggle\-lpm\-off/' /home/user/.local/share/applications/toggle-lpm.desktop
	dbus-send --print-reply --dest=com.meego.core.MNotificationManager /notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:"Standy Screen Off" string:'' string:"/home/user/.local/share/icons/hicolor/apps/toggle-lpm-off.png" uint32:0
        else
	gconftool -s --type=bool /system/osso/dsm/display/use_low_power_mode true
        sed -i 's/toggle\-lpm\-off/toggle\-lpm\-on/' /home/user/.local/share/applications/toggle-lpm.desktop
dbus-send --print-reply --dest=com.meego.core.MNotificationManager /notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:"Standy Screen On" string:'' string:"/home/user/.local/share/icons/hicolor/apps/toggle-lpm-on.png" uint32:0
fi

Contents of .desktop file:
Code:
~# cat /home/user/.local/share/applications/toggle-lpm.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=Toggle LPM
Exec=/bin/sh /home/user/.local/share/data/toggle-lpm/toggle-lpm.sh
Icon=/home/user/.local/share/icons/hicolor/apps/toggle-lpm-on.png
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

The above 2 are enough to do your own toggle instead of using a .deb to install etc...


Toggle-WLAN

Contents of sh script:
Code:
#!/bin/sh
# Toggle WLAN by thedead1440

STATUS=$(/sbin/mcetool --status | grep -v grep | grep WLAN | awk '{print $2}' | head -1)

if [ $STATUS == "enabled" ]
	then
	dbus-send --print-reply --dest=com.meego.core.MNotificationManager /notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:"WLAN Off" string:'' string:"/home/user/.local/share/icons/hicolor/apps/toggle-wlan-off.png" uint32:0
	sed -i 's/toggle\-wlan\-on/toggle\-wlan\-off/' /home/user/.local/share/applications/toggle-wlan.desktop
	gconftool -s --type=bool /system/osso/connectivity/network_type/restricted_mode true
	`/sbin/mcetool --disable-radio=wlan`
	else
	dbus-send --print-reply --dest=com.meego.core.MNotificationManager /notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:"WLAN On" string:'' string:"/home/user/.local/share/icons/hicolor/apps/toggle-wlan-on.png" uint32:0
	sed -i 's/toggle\-wlan\-off/toggle\-wlan\-on/' /home/user/.local/share/applications/toggle-wlan.desktop
	gconftool -s --type=bool /system/osso/connectivity/network_type/restricted_mode false
	`/sbin/mcetool --enable-radio=wlan`
fi
sh script without dbus call:

Code:
#!/bin/sh
# Toggle WLAN by thedead1440

STATUS=$(/sbin/mcetool --status | grep -v grep | grep WLAN | awk '{print $2}' | head -1)

if [ $STATUS == "enabled" ]
	then
	sed -i 's/toggle\-wlan\-on/toggle\-wlan\-off/' /home/user/.local/share/applications/toggle-wlan.desktop
	gconftool -s --type=bool /system/osso/connectivity/network_type/restricted_mode true
	`/sbin/mcetool --disable-radio=wlan`
	else
	sed -i 's/toggle\-wlan\-off/toggle\-wlan\-on/' /home/user/.local/share/applications/toggle-wlan.desktop
	gconftool -s --type=bool /system/osso/connectivity/network_type/restricted_mode false
	`/sbin/mcetool --enable-radio=wlan`
fi

.desktop file:

Code:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=Toggle WLAN
Exec=/bin/sh /home/user/.local/share/data/toggle-wlan/toggle-wlan.sh
Icon=/home/user/.local/share/icons/hicolor/apps/toggle-wlan-on.png
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
Name[en_SG]=toggle-wlan.desktop

Last edited by thedead1440; 2013-01-22 at 17:49. Reason: added info on toggle-wlan v1.0.1
 

The Following 8 Users Say Thank You to thedead1440 For This Useful Post: