event-sequence-transformation/quadtap-both-click.cfg

308 lines
5.7 KiB
INI
Raw Permalink Normal View History

2024-08-19 13:00:30 +03:00
constants = {
sensitivity_num = 2;
sensitivity_denom = 5;
};
enums = {
namespaces: ["clickpad", "window_terminator"];
};
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";
}
);
};
syn_event = {
type = "and";
args = (
"is_evdev",
{
type = "code_major";
min = "event_type.SYN";
max = "event_type.SYN";
}
);
};
abs_event = {
type = "and";
args = (
"is_evdev",
{
type = "code_major";
min = "event_type.ABS";
max = "event_type.ABS";
}
);
};
misc_event = {
type = "and";
args = (
"is_evdev",
{
type = "code_major";
min = "event_type.MSC";
max = "event_type.MSC";
}
);
};
btn_quadtap_event = {
type = "and";
args = (
"key_event",
{
type = "code_minor";
min = "button_event.TOOL_QUADTAP";
max = "button_event.TOOL_QUADTAP";
}
);
};
misc_timestamp = {
type = "and";
args = (
"misc_event",
{
type = "code_minor";
min = "misc_event.TIMESTAMP";
max = "misc_event.TIMESTAMP";
}
);
};
abs_x = {
type = "and";
args = (
"abs_event",
{
type = "code_minor";
min = "absolute_axis.X";
max = "absolute_axis.X";
}
);
};
abs_y = {
type = "and";
args = (
"abs_event",
{
type = "code_minor";
min = "absolute_axis.Y";
max = "absolute_axis.Y";
}
);
};
bypass = {
type = "or";
args = ["syn_event", "misc_timestamp"];
};
payload_zero = {
type = "payload";
min = 0;
max = 0;
};
payload_one = {
type = "payload";
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 = {
clickpad = {
type = "evdev";
options = {
file = "/dev/input/event7";
namespace = "namespaces.clickpad";
};
};
select_interesting_events = {
type = "router";
options = {
predicates = ["bypass", "btn_quadtap_event", "abs_x", "abs_y"];
};
};
quadtap_subst_seq = {
type = "tee";
};
morph_left_click = {
type = "assign";
options = {
minor = "button_event.LEFT";
};
};
morph_right_click = {
type = "assign";
options = {
minor = "button_event.RIGHT";
};
};
merge = {
type = "tee";
};
virtual_out = {
type = "uinput";
options = {
name = "Quadtap gesture";
enabled_codes = (
{major: "event_type.KEY"; minor: "button_event.LEFT"}
,
{major: "event_type.KEY"; minor: "button_event.RIGHT"}
,
{major: "event_type.KEY"; minor: "button_event.MIDDLE"}
,
{major: "event_type.REL"; minor: "relative_axis.X"}
,
{major: "event_type.REL"; minor: "relative_axis.Y"}
,
{major: "event_type.MSC"; minor: "misc_event.TIMESTAMP"}
);
2024-08-19 11:56:25 +03:00
properties = ["input_property.POINTER", "input_property.BUTTONPAD"];
};
};
differentiate_x = {
type = "differentiate";
};
differentiate_y = {
type = "differentiate";
};
morph_rel = {
type = "assign";
options = {
major = "event_type.REL";
// Preserve minor, because relative_axis.X = absolute_axis.X, relative_axis.Y = absolute_axis.Y
};
};
while_drag_held = {
type = "router";
options = {
predicates = ["drag_held"];
};
};
2024-08-19 13:00:30 +03:00
sensitivity_x = {
type = "scale";
options = {
numerator = "sensitivity_num";
denominator = "sensitivity_denom";
amortize_rounding_error = "true";
};
};
sensitivity_y = {
type = "scale";
options = {
numerator = "sensitivity_num";
denominator = "sensitivity_denom";
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 = ({
from: ("clickpad", 0);
to: ("select_interesting_events", 0);
}, {
from: ("select_interesting_events", 0); // EV_SYN
to: ("merge", 0);
}, {
from: ("select_interesting_events", 1); // BTN_TOOL_QUADTAP
to: ("quadtap_subst_seq", 0);
}, {
from: ("quadtap_subst_seq", 0);
to: ("morph_left_click", 0);
}, {
from: ("quadtap_subst_seq", 1);
to: ("morph_right_click", 0);
}, {
from: ("morph_left_click", 0);
to: ("merge", 1);
}, {
from: ("morph_right_click", 0);
to: ("merge", 2);
}, {
from: ("select_interesting_events", 2); // ABS_X
to: ("differentiate_x", 0);
}, {
from: ("select_interesting_events", 3); // ABS_Y
to: ("differentiate_y", 0);
}, {
from: ("differentiate_x", 0);
2024-08-19 13:00:30 +03:00
to: ("sensitivity_x", 0);
}, {
from: ("differentiate_y", 0);
2024-08-19 13:00:30 +03:00
to: ("sensitivity_y", 0);
}, {
from: ("sensitivity_x", 0);
to: ("while_drag_held", 0);
2024-08-19 13:00:30 +03:00
}, {
from: ("sensitivity_y", 0);
to: ("while_drag_held", 1);
}, {
from: ("while_drag_held", 0);
to: ("morph_rel", 0);
}, {
from: ("morph_rel", 0);
to: ("merge", 3);
}, {
from: ("merge", 0);
to: ("virtual_out", 0);
}, {
from: ("quadtap_subst_seq", 4);
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