diff --git a/quadtap-both-click.cfg b/quadtap-both-click.cfg index 77a265a..23cf393 100644 --- a/quadtap-both-click.cfg +++ b/quadtap-both-click.cfg @@ -4,7 +4,7 @@ constants = { }; enums = { - namespaces: ["clickpad"]; + namespaces: ["clickpad", "window_terminator"]; }; predicates = { @@ -101,10 +101,6 @@ predicates = { } ); }; - quadtap_held = { - type = "accept"; - inverted = 1; - }; bypass = { type = "or"; args = ["syn_event", "misc_timestamp"]; @@ -119,6 +115,19 @@ predicates = { min = 1; max = 1; }; + is_window_terminator = { + type = "code_ns"; + min = "namespaces.window_terminator"; + max = "namespaces.window_terminator"; + }; + inside_drag_window = { + type = "accept"; + inverted = 1; + }; + drag_held = { + type = "accept"; + inverted = 1; + }; }; nodes = { @@ -173,14 +182,6 @@ nodes = { properties = ["input_property.POINTER", "input_property.BUTTONPAD"]; }; }; - update_quadtap_held = { - type = "modify_predicate"; - options = { - target = "quadtap_held"; - uninvert_on = "payload_one"; - invert_on = "payload_zero"; - }; - }; differentiate_x = { type = "differentiate"; }; @@ -194,10 +195,10 @@ nodes = { // Preserve minor, because relative_axis.X = absolute_axis.X, relative_axis.Y = absolute_axis.Y }; }; - while_quadtap_held = { + while_drag_held = { type = "router"; options = { - predicates = ["quadtap_held"]; + predicates = ["drag_held"]; }; }; sensitivity_x = { @@ -216,6 +217,32 @@ nodes = { amortize_rounding_error = "true"; }; }; + drag_start_window = { + type = "window"; + options = { + max_length = 2; + max_milliseconds = 500; + terminator = { + namespace = "namespaces.window_terminator"; + }; + }; + }; + update_inside_drag_window = { + type = "modify_predicate"; + options = { + target = "inside_drag_window"; + uninvert_on = {type: "and"; args: ["is_evdev", "payload_zero"]}; + invert_on = "is_window_terminator"; + }; + }; + update_drag_held = { + type = "modify_predicate"; + options = { + target = "drag_held"; + uninvert_on = {type: "and"; args: ["inside_drag_window", "is_evdev", "payload_one"]}; + invert_on = {type: "and"; args: ["is_evdev", "payload_zero"]}; + }; + }; }; channels = ({ @@ -253,12 +280,12 @@ channels = ({ to: ("sensitivity_y", 0); }, { from: ("sensitivity_x", 0); - to: ("while_quadtap_held", 0); + to: ("while_drag_held", 0); }, { from: ("sensitivity_y", 0); - to: ("while_quadtap_held", 1); + to: ("while_drag_held", 1); }, { - from: ("while_quadtap_held", 0); + from: ("while_drag_held", 0); to: ("morph_rel", 0); }, { from: ("morph_rel", 0); @@ -268,7 +295,13 @@ channels = ({ to: ("virtual_out", 0); }, { from: ("quadtap_subst_seq", 4); - to: ("update_quadtap_held", 0); + to: ("drag_start_window", 0); +}, { + from: ("drag_start_window", 0); + to: ("update_inside_drag_window", 0); +}, { + from: ("drag_start_window", 1); + to: ("update_drag_held", 0); }); // vim: ft=libconfig