Reply
Thread Tools
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#11
Might as well leave this here, http://mohammadag.xceleo.org/Qt-examples/slide2lock/

If anyone's interested in it, I can package it up quickly and upload it to devel.
 

The Following 3 Users Say Thank You to MohammadAG For This Useful Post:
clasificado's Avatar
Posts: 466 | Thanked: 180 times | Joined on Feb 2010
#12
its something that worths a try. thanks dude
 
Posts: 7 | Thanked: 0 times | Joined on Dec 2010
#13
Sure, I am interested in trying it out.

Thanks
 
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#14
another approach:
apt-get install dbus-scripts
or install dbus-scripts via App Manager

add these 2(!) lines to /etc/dbus-scripts.d/dbus-scripts-settings (create the file if it doesn't exist)
Code:
#:soundonslide
/etc/dbus-scripts-scripts/playswoosh * * org.freedesktop.Hal.Device Condition ButtonPressed cover
create a folder /etc/dbus-scripts-scripts, and a file therein named playswoosh (my StarTrek style sound on slide out kbd, I'll just augment the code a bit here for the requested purpose). Set the file `chmod +x`

place following code to /etc/dbus-scripts-scripts/playswoosh:
Code:
#!/bin/sh
stored=/home/user/.slidestore;
slide=$(cat sys/devices/platform/gpio-switch/slide/state);
if [ X$slide == X$(cat $stored) ]; then exit 0; fi;
if [ X$slide == Xopen ]; then 
  /usr/bin/play-sound /usr/share/sounds/ui-charging_started.wav;
##next two lines are new and untested :-) and relevant for locking the screen
else
  /usr/bin/dbus-send --system --type=method_call \
    --dest=com.nokia.mce /com/nokia/mce/request \
    com.nokia.mce.request.req_tklock_mode_change string:"locked"
fi;
echo -n $slide >$stored
if you don't like the slide-out-swoosh, do this instead:
Code:
#!/bin/sh
stored=/home/user/.slidestore;
slide=$(cat sys/devices/platform/gpio-switch/slide/state);
if [ X$slide == X$(cat $stored) ]; then exit 0; fi;
if [ X$slide != Xopen ]; then 
  /usr/bin/dbus-send --system --type=method_call \
    --dest=com.nokia.mce /com/nokia/mce/request \
   com.nokia.mce.request.req_tklock_mode_change string:"locked"
fi;
echo -n $slide >$stored
Sorry for not actually testing it, if it has a typo, please let me know :-)
[edit] If somebody has this original chirping sound of Kirk's communicator, please toss it over. For the protocol: I know $stored better be a file in /tmp, feel free to edit.
[edit2] If you want to do other nice things with dbus-scripts, use dbus-monitor to find out about the dbus signal match-pattern to add to /etc/dbus-scripts.d/* (where * is any file, either the existing dbus-scripts-settings, or an arbitrary file you create for your new action)

cheers
jOERG
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N

Last edited by joerg_rw; 2010-12-15 at 17:11.
 

The Following 4 Users Say Thank You to joerg_rw For This Useful Post:
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#15
new version not playing any sound when lock-switch is held while sliding kbd open:

Code:
#!/bin/sh
# file: /etc/dbus-scripts-scripts/playswoosh
# chmod +x
stored=/tmp/slidestore;
slide=$(cat sys/devices/platform/gpio-switch/slide/state);
if [ X$slide == X$(cat $stored) ]; then exit 0; fi;
if [ $slide == open -a $(cat /sys/devices/platform/gpio-switch/kb_lock/state) == open ]; then /usr/bin/play-sound /usr/share/sounds/ui-charging_started.wav; fi;
echo -n $slide >$stored
for the screen locking on closing kbd slider you may want to add the "else" lines from above


I'm planning to change lock-switch hold to not immediately unlock screen, but instead slowly ramp up screen brightness from zero until you release the switch. Also on long "press" of lock-switch activate profile: silent.

Usecase: e.g. in cinema you want to "unlock" smoothly to a somewhat more discreet operation mode - so you press&hold the lockswitch, slide open kbd (no sound thanks to above little tweak), and watch the screen come up slowly in brightness until you just see enough and release the lock-switch.
Well, this is maybe just a bit OT in this thread, but anyway.

/j
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N

Last edited by joerg_rw; 2010-12-19 at 21:31.
 

The Following 2 Users Say Thank You to joerg_rw For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 21:27.