View Single Post
Old 10-25-2013, 02:56 AM   #1
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Lightbulb Simple way for exiting programs with power button without showing the screensaver

On some KUAL apps (like "draw"), physical power button has been used on KindleTouch and PW to execute some commands, like exiting the program. This was a bit annoying, because put the device into screensaver mode and user had to wake up the device later, by hand. To avoid this, just add to dbus-monitor event commands this one:

Code:
lipc-set-prop com.lab126.powerd powerButton 1
Screensaver won't show and user won't have to manually wake up the device. He will see only the light flashing on PW, for a minimal amount of time (maybe also this can be fixed, but is quite good as visual feedback too).

Sample KUAL app attached ("draw", renamed to "whiteboard" for the occasion)

App script:
Code:
#!/bin/sh
SSSTATE=`lipc-get-prop com.lab126.powerd preventScreenSaver`
lipc-set-prop com.lab126.powerd preventScreenSaver 0
/usr/bin/xtestlab126 &
( dbus-monitor "interface='com.lab126.powerd',member='goingToScreenSaver'" --system; killall xtestlab126; lipc-set-prop com.lab126.powerd powerButton 1; lipc-set-prop com.lab126.powerd preventScreenSaver "$SSSTATE" ) &
usleep 50000
killall -INT dbus-monitor
General approach:
Code:
( dbus-monitor "interface='com.lab126.interfaceName',member='interfaceEvent'" --system;  lipc-set-prop com.lab126.powerd powerButton 1; yourCommandsHere) &
Attached Files
File Type: zip whiteboard.zip (1.3 KB, 138 views)

Last edited by Aeris; 10-25-2013 at 06:32 PM. Reason: Updated to prevent screensaver
Aeris is offline   Reply With Quote