maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Powerlaunch and Offline Mode (https://talk.maemo.org/showthread.php?t=20541)

MysticKatDaddy 2008-05-29 11:46

Powerlaunch and Offline Mode
 
I'm trying to write a script for Powerlaunch where if the power button is pressed twice in a row within two seconds it will disable the wifi by putting the unit into "Offline"/"Flight Mode" and then active Powerlaunch's "Soft Poweroff" command.

Here's how the script will work:

When the Power Button is Pressed:
- If a specific timer is counting down, execute the command for "offline mode" and for "soft poweroff"
-If the timer is not counting down, start it counting down from 2 seconds.

Does anyone know the specific command or programs to run to execute the "offline mode" and the "soft poweroff"

austin 2008-05-30 11:43

Re: Powerlaunch and Offline Mode
 
You can look in systemui.conf for what the menu uses. 'call system.device.offline_mode' and 'softpoweroff' should work

MysticKatDaddy 2008-05-30 12:47

Re: Powerlaunch and Offline Mode
 
Does anyone know what kind of scripting powerline is based on? I'm familiar with Visual Basic programming and this is a bit different.

Benson 2008-05-30 19:57

Re: Powerlaunch and Offline Mode
 
It's based on itself (and not any other scripting language I know of, except inasmuch as glade is used for the UI). I assume you've looked at the documentation here...

MysticKatDaddy 2008-05-31 10:49

Re: Powerlaunch and Offline Mode
 
OK, I've got powerlaunch mostly figured out. I was able to insert a suspend mode option that does what I want in the pop up power menu. I did that by editing systemui.conf and adding the following into line 9 after the word "treeview" and before "tklock"

Code:

suspend "Suspend Mode"
and then putting this on line 28:

Code:

suspend = call system.device.offline_mode; call system.device.softpoweroff; hide
Here is the code for my original idea of a suspend.conf to go in the "/home/user/.powerlaunch/" directory:

Code:

[suspend_mode]
on_init = timer_set back_to_main 2
key_power = call systemui.ui.switch_offline_mode; call systemui.ui.softpoweroff;
back_to_main = switch powerlaunch.main

I don't have the double power button tap working but at least I have a menu option that will shut off the wifi and do a softpoweroff. I still want to figure out the double tap option. I'm having a hard time making a file in my "/home/user/.powerlaunch/" directory that will be automatically loaded by powerlaunch without having to modify any of the core config files. There's also an event for power_key_release that gets in the way too.

austin 2008-05-31 16:55

Re: Powerlaunch and Offline Mode
 
Quote:

Originally Posted by MysticKatDaddy (Post 187445)
Here is the code for my original idea of a suspend.conf to go in the "/home/user/.powerlaunch/" directory:

Code:

[suspend_mode]
on_init = timer_set back_to_main 2
key_power = call systemui.ui.switch_offline_mode; call systemui.ui.softpoweroff;
back_to_main = switch powerlaunch.main

I don't have the double power button tap working but at least I have a menu option that will shut off the wifi and do a softpoweroff. I still want to figure out the double tap option. I'm having a hard time making a file in my "/home/user/.powerlaunch/" directory that will be automatically loaded by powerlaunch without having to modify any of the core config files. There's also an event for power_key_release that gets in the way too.

To avoid modifying core files, create powerlaunch.conf in ~/.powerlaunch (you can copy one from /etc/powerlaunch if you wish and edit it). In main.on_init, use 'default_inherit suspend.suspend_mode' which will allow your double tap power thing to work from all modes (not sure if that's what you want).

For your double tap, maybe something like this (I haven't tried this)
Code:

[suspend_mode]
on_init = set powerdouble 0
key_power = if $powerdouble suspend waitsuspend
suspend = set powerdouble 0; call systemui.ui.switch_offline_mode; call systemui.ui.softpoweroff
waitsuspend = set powerdouble 1; timer_set clearsuspend 2
clearsuspend = set powerdouble 0

Not sure what you mean by the power key release getting in the way but you can override the default behavior if you want. The default is defined in common.conf.

superfisch 2008-06-01 04:50

Re: Powerlaunch and Offline Mode
 
Forgive me if this is OT, but I have my device set up to softpower and go offline on a power doubleclick. I was able to get this working by editing the /etc/mce/mce.ini file. Specifically the PowerKeyDoubleAction=softpoweroff and ConnectivityPolicyBattery=forceoffline keys. I have sliderotate installed and I noticed that the script made changes to this file to enable the rotating. (Which I didn't want) I'm not sure if the file existed before I installed sliderotate however. Hope this was usefull.

Benson 2008-06-02 17:32

Re: Powerlaunch and Offline Mode
 
Yes, that file does exist in a clean flash, and you can make whatever changes to it in the absence or presence of sliderotate. But this thread is about using powerlaunch, which replaces mce entirely, and has its own config files.


All times are GMT. The time now is 06:37.

vBulletin® Version 3.8.8