hadess / iio-sensor-proxy

IIO accelerometer sensor to input device proxy
197 stars 64 forks source link

Custom actions triggered by rotation #181

Closed evilphish closed 7 years ago

evilphish commented 7 years ago

I guess this is more a question than an issue in the sense of something not working right.

I am using a Lenovo X1 Carbon 2017 2nd Gen with Linux Mint 18.2. The standard repository still has an old 1.x version of iio-sensor-proxy which does not recognize any accelerometers but using the latest 2.2 version from the latest ubuntu repository does work fine, except for the brightness.

Either way, as soon as I rotate the laptop the screen rotates as well and (I use cinnamon) the stylus which is included with the laptop gets rotated too so everything is aligned and ready to go. However using your finger on the display or the touch pad results in misaligned clicks since those "devices" are not rotated. While this could be put on the shoulders of the cinnamon devs there are other things I would like to do whenever a rotation event is detected (Like disable the keyboard or trackpad completely, launch software, etc).

Is there a way to supply a custom script to iio-sensor-proxy which gets triggered if an event is received? If not is something like this planned? Is there any other way to use the event/trigger functionality from a third party script? Am I thinking too complex and is the solution easier than expected?

hadess commented 7 years ago

While this could be put on the shoulders of the cinnamon devs there are other things I would like to do whenever a rotation event is detected (Like disable the keyboard or trackpad completely, launch software, etc).

It is completely "on the shoulders of the cinnamon devs" as you mentioned. It's a desktop environment/compositor feature, nothing that iio-sensor-proxy can do about. libinput combined with mutter takes care of this in GNOME.

Is there a way to supply a custom script to iio-sensor-proxy which gets triggered if an event is received?

Yes, write a script that listens to D-Bus signals.

If not is something like this planned? Is there any other way to use the event/trigger functionality from a third party script? Am I thinking too complex and is the solution easier than expected?

I think you should file a bug against Cinnamon for them to fix their code, instead of looking for work-arounds.

evilphish commented 7 years ago

Thanks for the hints, much appreciated. I filed an issue with cinnamon and will leave the link here in case someone else is looking for the same thing. https://github.com/linuxmint/Cinnamon/issues/6837