Automatic screen lock

mqy meng.qingyou at gmail.com
Sat May 16 23:01:59 CEST 2009


As of simple lock (which does not turn off display backlight power), 
I think you don't need configure simple lock in frameworkd. 
The AUX key binding is enough -- just a press to lock screen.

If you really need the way of auto + manual, you have to write a ROBUST
application,
which listens to DBUS signals (idle + input event). Here is the pseudo C
code:

int locking = 0;
pthread_mutex lk = ...;

void lock_screen()
{
  pop up screen lock window which lay on top of other windows;
  optionally turn off display backlight power;
  locking = 1;
}

void unlock_screen()
{
  close the screen lock window;
  turn on display backlight power if it was turned off.
  locking = 0;
}

void dbus_idle_signal_handler()
{
  if (should lock screen) {
    lock(lk);
    if (! locking)
      lock_screen();
    unlock(lk);
  }
}

void dbus_input_event_signal handler()
{
  if (input event type == "pressed") {
    lock(lk);
    if (locking) {
       if (button is "AUX" || button is "POWER")
         unlock_screen();
    } else {
       if (button is "AUX")
         lock screen();
    }
    unlock(lk);
  }
}


Christian Rüb wrote:
> 
> Hi,
> 
> as I could not find another way to lock the screen I currently use this
> little script (illume + frameworkd):
> 
> /usr/local/bin/simple_lock:
> #!/bin/sh
> export E_IPC_SOCKET=$(find /var/ -type s | grep enlightenment | cut -d\|
> -f1)
> enlightenment_remote -exec-action "simple_lock" ""
> 
> in /etc/freesmartphone/oevents/rules.yaml:
> -
>     trigger: IdleState()
>     filters: HasAttr(status, "lock")
>     actions: Command('/usr/local/bin/simple_lock')
> 
> AUX button is also bound to desktop simple lock - otherwise it is
> impossible to unlock (withou sshing onto the phone)!
> 
> Unfortunately it does not always lock the screen, as the "simple_lock"
> action seems to be a toggle. Thus when you manually turn the lock on (via
> AUX) the power state "lock" now reverts the manually acquired simple lock.
> 
> Are there any plans to support a real locking in frameworkd - something
> like a touchscreen/keyboard resource? Or is there a way in enlightenment
> to force the lock and off?
> 
> Cheers,
>  Christian
> 
> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community
> 
> 

-- 
View this message in context: http://n2.nabble.com/Automatic-screen-lock-tp2913196p2913876.html
Sent from the Openmoko Community mailing list archive at Nabble.com.





More information about the community mailing list