Implementation - AndrewGuenther/XLeapr GitHub Wiki
Technologies Used
XLeapr is written in Python in order to access the LEAP APIs at a slightly higher level of abstraction than the raw C drivers. For X window control, we also use Python API wrappers.
Configuration
We have decided to implement the configuration as a JSON document for now. While a UI for editing this configuration would be nice, we have decided it is out of scope for the time being. All gesture bindings can be defined in the configuration as shown in the sample below. The specified bindings are in X windows keycode format. A detailed mapping can be found here: https://github.com/Ademan/python-xlib-branch/tree/master/Xlib/keysymdef
{
"flip":["Alt_L", "Tab"],
"swipe":["Control_L", "Alt_L"],
"clap":["Control_L", "Alt_L", "l"]
}
The configured keys are pressed and released in the order specified in the array.
Gesture API
Gestures are implemented just as outlined in the design. Each gesture is its own class which is dynamically imported at runtime. A sample can be seen below.
class Gesture:
CONTINUOUS = bool
COOLDOWN = int
def identify(LeapAPI.Frame frame):
return bool