maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Is somebody working on a "deep sleep" application? Silent/offline/... all in one (https://talk.maemo.org/showthread.php?t=37219)

DaSilva 2009-12-15 08:59

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Isn't it possible to edit the offline profile to make it the same like silent but without any connections? I have done this on my Nokia 5800 and when I go to bed I simply choose the offline profile and then all sounds (except alarm, which is good) are off and every connection (Bluetooth, GPS, GSM, 3G) is disabled. Isn't it the same on the N900 with the offline profile? I can't test it because I have to wait for my N900 :(

benny1967 2009-12-15 12:14

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
1 Attachment(s)
Quote:

Originally Posted by qwerty12 (Post 427963)
Here's an extremely crude hack:

Code:

#! /bin/sh

dbus-send --session --dest=com.nokia.profiled --type=method_call /com/nokia/profiled com.nokia.profiled.set_profile string:"silent"
dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_device_mode_change string:"offline"
wmctrl -l -p | grep -v hildon-home | grep -v hildon-status-menu | grep -v desktop | awk '{print $3}' | sort | uniq | while read p; do kill -9 $p; done
dbus-send --system --dest=com.nokia.mce --type=method_call /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"locked"


OK, it almost works now. I left out the wmctrl-part for the time being, but I still need some help because the way I do it, a black window keeps active even after un-locking the device.... But lets start:

One of my desktops has a pretty sleep symbol now. (Got the icon from here.) Tapping on it executes your script. So nice!

I put your script in the home directory and made it executable. Then I added a deepsleep.desktop file to /usr/share/applications/hildon/ (bug #1303 seems to be still open, so I didn't even try to do it in my $HOME):
Code:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Name=Sleep
Terminal=false
Type=Application
Comment=Akku schonen
Exec=/home/user/deepsleep.sh
Icon=sleep
X-Window-Icon=   
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

No idea about all the X-entries, it was copypasted from another thread here.

The icon sleep.png went to /usr/share/icons/hicolor/48x48/hildon/

That was it. My first Maemo 5 application. ;)
(OK, it's your code, but I made it appear in the applications menu :D ...)

Beautiful solution? Almost. It does everything it should do, except that it keeps a black window open. This window shows while the script shuts down the services, but it's still there after I unlock the screen afterwards. Tapping on the task switcher makes in disappear, but it simply isn't nice. What's that? Anything in the .desktop file causing it? Or do I need to exit the script in a special way to prevent this?

msa 2009-12-15 12:34

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
does it still receive calls when in deepsleep-mode?

benny1967 2009-12-15 12:46

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by msa (Post 428838)
does it still receive calls when in deepsleep-mode?

no. that's the whole point, isn't it?

it's in "offline mode", just like it is when you manually select "offline mode" on the device.

but as i wrote in my original post, the ideal solution would be to be able to configure which parts of the system go down and which stay up.

as it is now, if you want to disconnect from LAN but still receive phone calls (maybe you'd like to switch back from 3G or dual mode to plain GSM when you do this), you'll need to edit qwerty12's script - but don't ask me how. ;)

go1dfish 2009-12-15 12:48

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by benny1967 (Post 428818)
Beautiful solution? Almost. It does everything it should do, except that it keeps a black window open. This window shows while the script shuts down the services, but it's still there after I unlock the screen afterwards. Tapping on the task switcher makes in disappear, but it simply isn't nice. What's that? Anything in the .desktop file causing it? Or do I need to exit the script in a special way to prevent this?

You might try the Terminal variable: http://standards.freedesktop.org/des...t/ar01s05.html

I'm not sure which value will give you the behavior your looking for though. I haven't tried doing any desktop icons on maemo yet.

You might also try adding a & to the end of your exec line, to possibly run the process in the background.

qwerty12 2009-12-15 13:46

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by benny1967 (Post 428818)
Almost. It does everything it should do, except that it keeps a black window open. This window shows while the script shuts down the services, but it's still there after I unlock the screen afterwards. Tapping on the task switcher makes in disappear, but it simply isn't nice. What's that? Anything in the .desktop file causing it? Or do I need to exit the script in a special way to prevent this?

This is a Maemo 5 hildon-desktop speciality. I also get that window even when deepsleep.sh contains "exit 0".

Anyway, there's a partial-workaround for this: Use X-App-Loading-Image=none in the desktop file. The reason why it's partial is, if you unlock using the touchscreen slider, it will be gone. If you unlock using the physical slider, it will reside on the screen. Blame hildon-desktop. See below.

Quote:

Originally Posted by benny1967
but as i wrote in my original post, the ideal solution would be to be able to configure which parts of the system go down and which stay up.

I have no need for this, personally, so I won't be making anything configurable but I can make a quick and simple widget that resides in the status-menu area (in C; not Python) that will do the above with one press and will not have that window bug. Let me know.

benny1967 2009-12-15 14:09

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by qwerty12 (Post 428942)
This is a Maemo 5 hildon-desktop speciality. I also get that window even when deepsleep.sh contains "exit 0".

[…]

Blame hildon-desktop. See below.

So is this actually a bug in hildon-desktop? I'm missing the "see below"-part ;)

DaSilva 2009-12-16 07:16

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by DaSilva (Post 428619)
Isn't it possible to edit the offline profile to make it the same like silent but without any connections? I have done this on my Nokia 5800 and when I go to bed I simply choose the offline profile and then all sounds (except alarm, which is good) are off and every connection (Bluetooth, GPS, GSM, 3G) is disabled. Isn't it the same on the N900 with the offline profile? I can't test it because I have to wait for my N900 :(

I still don't understand why this does not the same. Can someone please explain it to me. Maybe I am wrong because I cannot test it. Thanks

benny1967 2009-12-16 07:50

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Quote:

Originally Posted by DaSilva (Post 430061)
I still don't understand why this does not the same. Can someone please explain it to me. Maybe I am wrong because I cannot test it. Thanks

I don't see a simple way to edit profiles at all on the N900. I can select them, but not edit them (except setting vibration on/off for each profile).

Also. a profile wouldn't help me to shut down running applications.

DaSilva 2009-12-16 08:13

Re: Is somebody working on a "deep sleep" application? Silent/offline/... all in one
 
Ah, now I understand. I thought you could edit the profiles like on other Nokia phones but maybe Nokia will release this feature with a new firmware.


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

vBulletin® Version 3.8.8