maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N9 / N950 (https://talk.maemo.org/forumdisplay.php?f=51)
-   -   Toggle Standby (LPM) Screen + Toggle WLAN (https://talk.maemo.org/showthread.php?t=88466)

thedead1440 2012-12-31 17:35

Toggle Standby (LPM) Screen + Toggle WLAN
 
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:
http://db.tt/UTUnHI5L

http://db.tt/SNdYlon5

thedead1440 2012-12-31 17:42

Re: Toggle Standby (LPM) Screen
 
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


AMD 2012-12-31 18:11

Re: Toggle Standby (LPM) Screen
 
YES YES YES YES YES YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS SSSSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!!!! AWESOME! Imma get it now :D

nbedford 2012-12-31 18:24

Re: Toggle Standby (LPM) Screen
 
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)

MK99 2012-12-31 18:26

Re: Toggle Standby (LPM) Screen
 
This is so great! Thanks a lot!:D

thedead1440 2012-12-31 18:29

Re: Toggle Standby (LPM) Screen
 
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 :D

Mikkosssss 2012-12-31 20:13

Re: Toggle Standby (LPM) Screen
 
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.

nbedford 2012-12-31 20:26

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by thedead1440 (Post 1309529)
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 :D

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 2012-12-31 20:45

Re: Toggle Standby (LPM) Screen
 
Would it be possible, so that when you charging, the display is on.:rolleyes:

thedead1440 2013-01-01 00:48

Re: Toggle Standby (LPM) Screen
 
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.


All times are GMT. The time now is 01:51.

vBulletin® Version 3.8.8