Compare commits

...

2 Commits

Author SHA1 Message Date
Vftdan 97b90cd1af Basic quadtap -> left_click + right_click config 2024-08-18 18:53:10 +02:00
Vftdan 1c9cdf80a0 Add "true" and "false" to constants 2024-08-18 18:52:08 +02:00
2 changed files with 121 additions and 0 deletions

View File

@ -392,6 +392,8 @@ load_config(const config_setting_t *config_root, FullConfig *config)
const config_setting_t *enums_config = config_setting_get_member(config_root, "enums"); const config_setting_t *enums_config = config_setting_get_member(config_root, "enums");
const config_setting_t *predicates_config = config_setting_get_member(config_root, "predicates"); const config_setting_t *predicates_config = config_setting_get_member(config_root, "predicates");
hash_table_init(&config->constants, NULL); hash_table_init(&config->constants, NULL);
hash_table_insert(&config->constants, hash_table_key_from_cstr("false"), (long long[1]) {0});
hash_table_insert(&config->constants, hash_table_key_from_cstr("true"), (long long[1]) {1});
populate_event_codes(&config->constants); populate_event_codes(&config->constants);
load_constants_section(constants_config, &config->constants); load_constants_section(constants_config, &config->constants);
load_enums_section(enums_config, &config->constants); load_enums_section(enums_config, &config->constants);

119
quadtap-both-click.cfg Normal file
View File

@ -0,0 +1,119 @@
enums = {
namespaces: ["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";
}
);
};
syn_event = {
type = "and";
args = (
"is_evdev",
{
type = "code_major";
min = "event_type.SYN";
max = "event_type.SYN";
}
);
};
btn_quadtap_event = {
type = "and";
args = (
"key_event",
{
type = "code_minor";
min = "button_event.TOOL_QUADTAP";
max = "button_event.TOOL_QUADTAP";
}
);
};
};
nodes = {
clickpad = {
type = "evdev";
options = {
file = "/dev/input/event7";
namespace = "namespaces.clickpad";
};
};
select_interesting_events = {
type = "router";
options = {
predicates = ["syn_event", "btn_quadtap_event"];
};
};
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"}
);
};
};
};
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: ("merge", 0);
to: ("virtual_out", 0);
});
// vim: ft=libconfig