On Mon, 10 Dec 2018 17:34:53 +0300 Vasiliy Tolstov <[email protected]> said:

> вс, 9 дек. 2018 г. в 14:32, Carsten Haitzler <[email protected]>:
> >
> > On Sun, 9 Dec 2018 11:23:34 +0300 Vasiliy Tolstov <[email protected]>
> > said:
> >
> > > Hi! I'm writing app that periodically scans bluetooth low energy
> > > devices and if known device in needed range - unlock screen, and when
> > > range is bigger then needed - lock.
> > > I found enlightenment_remote -desktop-lock, but how to do in my case
> > > unlocking? As i see via dbus this is not possible. Why?
> >
> > enlightenment_remote is nothing but a handy shell wrapper around the msgbus
> > extensions module ... the script only has lock... the dbus protocol also has
> > unlock. so you need to load the msgbus module to get these controls working
> > to begin with. that's the dbus extension module under system. then use
> > d-feet or something to explore the interface/api and have your app actually
> > use the dbus protocol... :)
> 
> Thanks! Last question - if i want to after lid open automatic unlock
> via dbus if i see bluetooth device in nearest range, how can i ran my
> app only when lid is open?
> I know about screen lock app and screen unlock app, but when it runs?

you'll have to figure out how to see lid events - acpid for example (this is
what enlightenment does). do you really care about the lid closing OR the
system suspending... OR the screen locking as they are all different things.
lid closing is just an event. what happens as a result is another matter.

if it were an enlightenment module it'd have access to enlightenment's
internal events and be able to see this as well as have detailed access t the
desklock api and infra and status etc.

as enlightenment has an up to date bluez5 module now it makes a lot more sense
at least to enlightenment to just have the bluez5 module have this feature as it
already tracks all bt devices that bluez knows about (paired or scanned). so
it'd be a trivial bit of code to add like:

// existing callback for when bt objects (e.g. devices) are added by bluez
cb_obj_add(Obj *obj) {
...
if (is_in_unlock_list(obj->address) {
   Eina_List *l;
   E_Zone *zone;

   e_desklock_hide();
   EINA_LIST_FOREACH(e_comp->zones, l, zone) {
      e_desklock_zone_block_set(zone, EINA_TRUE);
   }
}
...
}

// existing callback when bt objects are removed by bluez

ebluez5_popup_device_del(Obj *obj) {
...
if (is_in_unlock_list(obj->address) {
   Eina_List *l;
   E_Zone *zone;

   EINA_LIST_FOREACH(e_comp->zones, l, zone) {
      e_desklock_zone_block_set(zone, EINA_FALSE);
   }
}
...
}

actually i probably should add some more infra to desklock specifically to have
a single suspend "refcount" for desklock so the lock will come back up if asked
for once the block count goes to 0. also the above code probably should also
count the number of unlock devices and only do a block or unblock when it goes
from 0 or back to 0. but it's a fairly small and easy amount of code. it all
depends on how complex it should be. should just the existence of a bt device
count - should it have been paired before? connected? lots of bt devices don't
auto-connect.... should this just affect lock? should it enforce suspend when
the bt device(s) go away? or force just a screen blank? or a blank+lock? ... :)
keeping it simple means not having all of these options. :)

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - [email protected]



_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to