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.

Win7Mac 2013-01-01 12:56

Re: Toggle Standby (LPM) Screen
 
What an awesome new years' present, an "app" just for me... :D
Really this blows my mind.
thedead, you're wonderful, thank you so much! :)

Win7Mac 2013-01-01 14:37

Re: Toggle Standby (LPM) Screen
 
1 Attachment(s)
I edited the toggle-lpm-on.png to show some more info, so it doesn't look that naked... :)
If you like it, put it in /usr/share/icons/hicolor/80x80/apps/ if you're using v1.0
or to /home/user/.local/share/icons/hicolor/apps if you're using v1.1.
https://www.dropbox.com/s/km7vvq34px...gle-lpm-on.png

MK99 2013-01-01 15:24

Re: Toggle Standby (LPM) Screen
 
I noticed that there are on- and off-icons.
It doesn't change when I click it. Icon is allways "on".

thedead1440 2013-01-01 15:29

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by MK99 (Post 1309733)
I noticed that there are on- and off-icons.
It doesn't change when I click it. Icon is allways "on".

The on and off icons are used in the banner message that is displayed when toggled... Implementing an icon that changes between on and off requires svg and when I did this yesterday I didn't have the time to do so... Maybe over the next day or two I'll implement it to do that...

mousse04 2013-01-01 19:34

Thanks thedead. Was lazzy to go in the setting ;)

thedead1440 2013-01-02 17:00

Re: Toggle Standby (LPM) Screen
 
Changelog:

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

The .deb for v1.1 can be gotten here
_______________

The above is taken from the first post. Updated version changes the icon's state as appropriate. Installing over the old version should be no issue but those who want to be 100% safe purge the older version first.

coderus 2013-01-02 17:05

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by thedead1440 (Post 1309735)
The on and off icons are used in the banner message that is displayed when toggled... Implementing an icon that changes between on and off requires svg and when I did this yesterday I didn't have the time to do so... Maybe over the next day or two I'll implement it to do that...

really? too lazy to create two icons? :D
bonus: you can place desktop file to ~/.local/share/applications

thedead1440 2013-01-02 17:06

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by coderus (Post 1310178)
really? too lazy to create two icons? :D
bonus: you can place desktop file to ~/.local/share/applications

Yes was lazy yesterday but not today :p the post above yours says I did exactly that including moving to userfs :D

coderus 2013-01-02 17:08

Re: Toggle Standby (LPM) Screen
 
aha i see now)

coderus 2013-01-02 17:08

Re: Toggle Standby (LPM) Screen
 
but can you teach me about any useful situation where i can use this toggle?

thedead1440 2013-01-02 17:12

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by coderus (Post 1310184)
but can you teach me about any useful situation where i can use this toggle?

Like I mentioned expressly in the first post I don't have a use for it; it was done on a request by Win7Mac :D

Maybe he wants to toggle it while sleeping etc or like nbedford posted, at times after reboot his standby screen doesn't work as expected...

After all it was an easy toggle to do and I didn't want to post it but since I did it I just posted it here...

coderus 2013-01-02 17:17

Re: Toggle Standby (LPM) Screen
 
okay. just a had same requests for unrestricted widgets :D

mousse04 2013-01-02 18:05

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by thedead1440 (Post 1310187)
Like I mentioned expressly in the first post I don't have a use for it; it was done on a request by Win7Mac :D

Maybe he wants to toggle it while sleeping etc or like nbedford posted, at times after reboot his standby screen doesn't work as expected...

After all it was an easy toggle to do and I didn't want to post it but since I did it I just posted it here...

Personally, I'm using it to disable lpm before sleeping ��

Schturman 2013-01-02 18:21

Re: Toggle Standby (LPM) Screen
 
Profilematic do it automatically :D :p

Hacker 2013-01-02 18:28

I use this app with powersave mode and times when I don't need the standby screen. Its one-touch access is much easier than drilling down into the settings menu every time, so thanks for putting this out for all to enjoy.

coderus 2013-01-02 18:28

Re: Toggle Standby (LPM) Screen
 
i just putting my phone screen down to disable screen for night :D

Win7Mac 2013-01-02 20:05

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by coderus (Post 1310223)
i just putting my phone screen down to disable screen for night :D

Whow... you're such a clever guy :rolleyes:

Quote:

Originally Posted by coderus (Post 1310184)
but can you teach me about any useful situation where i can use this toggle?

Is your imagination really that weak or are you just so ignorant for things you or your girlfriend don't use/want/need?
Personally, I'd prefer to have the toggle in your Status Menu Extensions but since you cancelled support for it, this is just excellent.

Quote:

Originally Posted by coderus (Post 1310192)
okay. just a had same requests for unrestricted widgets :D

See? I'm not the only one. And there are already 20 other users who said Thank You to thedead1440 For This Useful Post.

Again, it's all about having choice, don't you think?
You don't want it? Then why even bother and mock around here?
Please stop spamming and save your one-liners for your threads.
Bye.

coderus 2013-01-02 20:11

Re: Toggle Standby (LPM) Screen
 
@Win7Mac hello and bye-bye. I'm chatting not with you. Seriously.

Win7Mac 2013-01-03 00:46

Re: Toggle Standby (LPM) Screen
 
2 Attachment(s)
I put up new icons, I hope the're more distinguishable (also to clearly differ from Billboard-icon).
If you have other ideas about them please let me know and I'll do my best.
They'll be implemented in the next update v1.1.1 by thedead.
If you want to add them manually, put them in
/home/user/.local/share/icons/hicolor/apps
and go switch it! :)

screenshots:
https://dl.dropbox.com/s/ry4zezqzx4u...een-PSM_on.png

https://dl.dropbox.com/s/uznsxvovcq8...en-PSM_off.png

Win7Mac 2013-01-03 18:13

Re: Toggle Standby (LPM) Screen
 
v1.1.1 is online. :) Thanks thedead1440!
Only difference to v1.1: the above icons are included.
The .deb can be gotten here.
Enjoy. :)

bibek 2013-01-20 17:53

Would it be a wrong place to ask for a Mobile Data toggle? Based on this : http://talk.maemo.org/showpost.php?p...&postcount=983

i messed around for some time, but couldn't get the desktop file working :/

thedead1440 2013-01-20 19:22

Re: Toggle Standby (LPM) Screen
 
bibek,

Your wish is my command :D

Here you go:

Code:

#!/bin/sh

# Toggle WLAN radio state

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:'' uint32:0
        `/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:'' uint32:0
        `/sbin/mcetool --enable-radio=wlan`
fi

Save the above as /home/user/wlan.sh or anything to your heart's content...


Then for the .desktop file:

Code:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=Toggle WLAN
Exec=/bin/sh /home/user/wlan.sh
Icon=
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

save it as /home/user/.local/share/applications/toggle-wlan.desktop or anything you like and it is good to go ;)

Icons not added; you can add them if you want to...

N9uwu 2013-01-20 19:54

Re: Toggle Standby (LPM) Screen
 
Does anyone know where I should start looking, if I wanted to disable/enable the LPM screen bases on available notifications?
The "condition" I am looking for is the presence of a new call/sms/etc notification (which leads to a LPM notification symbol). I'd really appreciate any help or input as to where I can find/query this "condition".

Win7Mac 2013-01-20 20:15

Re: Toggle Standby (LPM) Screen
 
2 Attachment(s)
Usually, I switch powersave mode to achieve almost the same.
Here are some leaked protos of icons... :)
Ideas to add some beauty are very welcome.

Hacker 2013-01-20 20:47

Quote:

Originally Posted by Win7Mac (Post 1310593)
v1.1.1 is online. :) Thanks thedead1440!
Only difference to v1.1: the above icons are included.
The .deb can be gotten here.
Enjoy. :)

thedead1440 -- the link to the .deb for version 1.1.1 of the lpm toggle is 404'ing on me (same with the link in the first post). Could you please take a look and hook up a new link? Thanks.

Win7Mac 2013-01-20 20:58

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by Hacker (Post 1316180)
the link to the .deb for version 1.1.1 of the lpm toggle is 404'ing on me.

Fixed now.

imaginaryenemy 2013-01-21 04:40

Quote:

Originally Posted by bibek (Post 1316133)
Would it be a wrong place to ask for a Mobile Data toggle? Based on this : http://talk.maemo.org/showpost.php?p...&postcount=983

i messed around for some time, but couldn't get the desktop file working :/

I can't get mcetools to install. I tried apt-get and the provided deb. I get an error in terminal with the apt-get and i get an invalid installation package error from the deb. Any help?

thedead1440 2013-01-21 04:45

Re: Toggle Standby (LPM) Screen
 
Quote:

Originally Posted by imaginaryenemy (Post 1316232)
I can't get mcetools to install. I tried apt-get and the provided deb. I get an error in terminal with the apt-get and i get an invalid installation package error from the deb. Any help?

You have to incept the package or use fixed origin if in open mode...

bibek 2013-01-21 11:16

Re: Toggle Standby (LPM) Screen
 
2 Attachment(s)
I got the data toggle working, but trying to make it interactive like the LPM isn't working.
Wanted to skip the notification, as it slows down ui during popup. And tried to change the icon name.
Getting errors in syntax and all types of mess.

thedead1440 can you package something like the lpm toggle?

Some Icons attached, in case you need.. from alternative icons thread http://talk.maemo.org/showthread.php?t=85769

Here's my code(not working)
#icon name is Data On
Code:

#!/bin/sh

# Toggle WLAN radio state

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

if [ $STATUS == "enabled" ]
        then
        sed -i 'On/Off/' /home/user/.local/share/applications/netToggle.desktop
        `/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:'' uint32:0
        `/sbin/mcetool --enable-radio=wlan`
fi


thedead1440 2013-01-21 12:03

Re: Toggle Standby (LPM) Screen
 
bibek,

Get toggle-wlan from here...

If you want the version without the dbus calls get v1.0-1 from here...

You can read the scripts here


All times are GMT. The time now is 10:50.

vBulletin® Version 3.8.8