Design - AndrewGuenther/XLeapr GitHub Wiki

Data Flow
The LEAP motion API serves as the primary input for XLeapr. XLeapr analyzes the data from the API frame by frame in order to identify gestures and trigger the appropriate responses. These responses are sent through the X Window mocking API which allows developers to programatically inject input events from the "mouse" and "keyboard." X window will then pass these events on to the host application where they are handled just as if they were natural input.
Configuration
On launch, XLeapr will read in the configuration file specified on the command-line. Once the configuration has been loaded, XLeapr will load its gestures from the default location or a directory specified in the configuration.
Custom Gestures
Gestures fall into one of two categories, discrete or continuous. Discrete gestures are triggered and then must wait for a cooldown time before they can be triggered again. Continuous gestures are triggered any time the gesture is detected, without any cooldown.
All gestures will inherit from the Gesture class, and their type will be determined by a boolean class variable, CONTINUOUS. Discrete Gestures can also choose to specify their own COOLDOWN time.
The Gesture interface is defined as:
class Gesture:
CONTINUOUS = bool
COOLDOWN = int
def identify(LeapAPI.Frame frame):
return bool
The identify method is called for every frame taken from the LEAP API. identify then returns a boolean to indicate whether the gesture has been detected.
Gesture Priority
XLeapr will only trigger a single Gesture per frame. First priority goes to the (if any) continuous Gesture detected in the last frame. Continuous Gestures take first priority and are then sorted based on the order specified in the configuration.