Reply
Thread Tools
Moderator | Posts: 6,150 | Thanked: 6,029 times | Joined on Nov 2011
#1
A small toggle for the standby/lpm screen on the N9 based upon the request of Win7Mac has been created. He mentioned that going into settings and toggling was too cumbersome hence wanted a toggle on the homescreen.

I don't think this is required by most people (I don't need it too) but since I've done it might as well post it here.

Basically its just 2 icons, 1 sh file and 1 .desktop file.

.DEB for Toggle-LPM:
v1.1.1

.DEBs for Toggle-WLAN:
v1.0.1
v1.0.1-1


All files are here for toggle-lpm and here for toggle-wlan so feel free to modify if requried.


Changelog:

Toggle Wlan v1.0.1 and v1.0.1-1 - 22/02/13:
  • Added toggling of background connections when enabling/disabling internet connection

Added Toggle WLAN v1.0 and v1.0-1 - 21/02/13:
  • Toggle WLAN & Internet Connection
  • Icons by bibek
  • Only difference between v1.0 & v1.0-1 is the absence of the dbus call in the latter to indicate change of status
  • mcetools is a must for toggle-wlan; get it from the Harmattan SDK repo or from here. Install it via inception (for regular mode) or FIXED_ORIGIN if in open mode

v1.1.1 - 04/01/13:
v1.1 - 03/01/13:
  • Updated icon to reflect current status when toggled
  • Files moved to userfs partition

v1.0 - 01/01/13:
  • Initial release

Screenshots:



Last edited by thedead1440; 01-22-2013 at 01:33 PM. Reason: added info on toggle-wlan
 

The Following 31 Users Say Thank You to thedead1440 For This Useful Post:
Moderator | Posts: 6,150 | Thanked: 6,029 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; 01-22-2013 at 01:49 PM. Reason: added info on toggle-wlan v1.0.1
 

The Following 8 Users Say Thank You to thedead1440 For This Useful Post:
AMD's Avatar
Posts: 1,386 | Thanked: 670 times | Joined on May 2012 @ Beirut, Lebanon
#3
YES YES YES YES YES YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS SSSSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!!!! AWESOME! Imma get it now
__________________
Twiiter: @AMD_90
Add me on Facebook.
Originally Posted by Dave999
I will vote AMD for president next time if I'm having any shares during next meeting.


Do good for a human being and like my art page!
 

The Following 2 Users Say Thank You to AMD For This Useful Post:
Posts: 228 | Thanked: 128 times | Joined on Jan 2012 @ UK
#4
Actually I think this could be useful.

I sometimes (not 100% reproducable) have a problem whereby when I perform a reboot, my lpm is off (even though the Settings UI says it is on!) I have (possibly erronously) put this down to some sort of bug/timing issue/race condition with profilmatic, as i have a rule in their that turns on/off my lpm based on certain conditions.

This could be a quick fix.

EDIT: I guess from reading the script it will depend upon whether the my lpm state is correctly mirroring the gconf key or not (I suspect that actually the Settings UI is what is mirroring the gconf key)
 

The Following User Says Thank You to nbedford For This Useful Post:
MK99's Avatar
Posts: 644 | Thanked: 474 times | Joined on Jul 2012 @ Finland
#5
This is so great! Thanks a lot!
 

The Following User Says Thank You to MK99 For This Useful Post:
Moderator | Posts: 6,150 | Thanked: 6,029 times | Joined on Nov 2011
#6
nbedford,

Even if it isn't mirroring the gconf key correctly, the script gets the present gconf then makes the change so maybe toggling more than once fixes it... Do report if it does help as I didn't expect anyone other than Win7Mac to have any use for this
 
Mikkosssss's Avatar
Posts: 551 | Thanked: 322 times | Joined on Apr 2012 @ Finland
#7
Thanks.

You should put it store or let Win7Mac put it there.

New request: Shortcut to open conversation. its that where you see who is online in FB, Skype...
I cant find or I dont know where to look for how to do it.
Thanks

And bug report if you disable low power screen with this it doesnt ask security code anymore and when you press it to switch lps back on it jumps to screen where you put security code when you open phone.

E: Made screen off very buggy sometimes it skipped wallpaper screen and securitycode screen sometimes I got securitycode screen on random places.
Had to reboot.
not usable for me.

Last edited by Mikkosssss; 12-31-2012 at 04:37 PM.
 
Posts: 228 | Thanked: 128 times | Joined on Jan 2012 @ UK
#8
Originally Posted by thedead1440 View Post
nbedford,

Even if it isn't mirroring the gconf key correctly, the script gets the present gconf then makes the change so maybe toggling more than once fixes it... Do report if it does help as I didn't expect anyone other than Win7Mac to have any use for this
Yes, I have to toggle twice to get back in sync, but at least your script saves me having to open up the Settings->Device->Display screen and toggeling lpm there!

Thanks

-Nic
 
MK99's Avatar
Posts: 644 | Thanked: 474 times | Joined on Jul 2012 @ Finland
#9
Would it be possible, so that when you charging, the display is on.
 
Moderator | Posts: 6,150 | Thanked: 6,029 times | Joined on Nov 2011
#10
Mikkosssss,

I've sent you a PM to troubleshoot your issue.

Currently I am able to open a new message using an icon but not to that Contact List yet...

--Edit-- After contacting Mikkosssss over PM it seems a re-install was all he needed to get it working so it means a security lock shouldn't be causing an issue...


MK99, I'll check and report if I can get the method for doing that.

Last edited by thedead1440; 12-31-2012 at 09:56 PM.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT -4. The time now is 03:29 AM.