constants = { my_modifier = 9; }; enums = { namespaces: ["stdin", "clickpad"]; }; predicates = { is_evdev = { type = "code_ns"; min = "namespaces.clickpad"; max = "namespaces.clickpad"; }; key_event = { type = "and"; args = ( "is_evdev", { type = "code_major"; min = "event_type.KEY"; max = "event_type.KEY"; } ); }; btn_touch_event = { type = "and"; args = ( "key_event", { type = "code_minor"; min = "button_event.TOUCH"; max = "button_event.TOUCH"; } ); }; payload_zero = { type = "payload"; min = 0; max = 0; }; payload_one = { type = "payload"; min = 1; max = 1; }; touch_held = { type = "accept"; inverted = 1; }; }; nodes = { stdin = { type = "getchar"; options = { namespace = "namespaces.stdin"; }; }; print = { type = "print"; options = {}; }; clickpad = { type = "evdev"; options = { file = "/dev/input/event7"; namespace = "namespaces.clickpad"; // grab = 1; }; }; select_key_events = { type = "router"; options = { predicates = ( "key_event", { type = "or"; inverted = 1; args = ["key_event"]; } ); }; }; set_modifier = { type = "modifiers"; options = { operation = "set"; modifiers = ["my_modifier"]; }; }; update_touch_held = { type = "modify_predicate"; options = { target = "touch_held"; uninvert_on = {type: "and", args: ["btn_touch_event", "payload_one"]}; invert_on = {type: "and", args: ["btn_touch_event", "payload_zero"]}; }; }; while_touch_held = { type = "router"; options = { predicates = ["touch_held"]; }; }; uinput_output = { type = "uinput"; options = { name = "Resulting device"; enabled_codes = ( {major: "event_type.KEY"; minor: "button_event.LEFT"} , {major: "event_type.KEY"; minor: "button_event.RIGHT"} , {major: "event_type.ABS"; minor: "absolute_axis.X"; data: {minimum: 0; maximum: 3200; resolution: 0}} ); }; }; }; channels = ({ from: ("stdin", 0); to: ("select_key_events", 0); }, { from: ("clickpad", 0); to: ("select_key_events", 1); }, { from: ("select_key_events", 0); to: ("set_modifier", 0); }, { from: ("set_modifier", 0); to: ("print", 0); }, { from: ("select_key_events", 1); to: ("while_touch_held", 0); }, { from: ("while_touch_held", 0); to: ("print", 1); }, { from: ("clickpad", 1); to: ("update_touch_held", 0); }); // vim: ft=libconfig