Notices


Reply
Thread Tools
Posts: 30 | Thanked: 5 times | Joined on May 2008
#1
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"
 
Posts: 34 | Thanked: 21 times | Joined on Feb 2008
#2
You can look in systemui.conf for what the menu uses. 'call system.device.offline_mode' and 'softpoweroff' should work
 

The Following User Says Thank You to austin For This Useful Post:
Posts: 30 | Thanked: 5 times | Joined on May 2008
#3
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's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#4
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...
 
Posts: 30 | Thanked: 5 times | Joined on May 2008
#5
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.
 
Posts: 34 | Thanked: 21 times | Joined on Feb 2008
#6
Originally Posted by MysticKatDaddy View Post
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.
 
Posts: 5 | Thanked: 9 times | Joined on May 2008 @ Minneapolis
#7
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's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#8
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.
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:18.