caps2esc:logo4alt

Interception tools plugin that maps caps->{esc,ctrl} and logo<->alt
git clone git://git.deurzen.net/caps2esc:logo4alt
Log | Files | Refs | README | LICENSE

commit 975bb742841244141012c05e0c624672160af3e0
parent 8bfd57eda2153fa288aa484da0eb0a70e8210b47
Author: Francisco Lopes <francisco@nosubstance.me>
Date:   Fri,  1 Jan 2021 00:18:03 -0300

Passthrough mouse events

To not block mice that have keys, which end up grabbed due to generic
configurations that simply filter anything that responds to CAPSLOCK/ESC.

Fixes #15

Diffstat:
Mcaps2esc.c | 34++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/caps2esc.c b/caps2esc.c @@ -46,25 +46,23 @@ void write_event(const struct input_event *event) { } void write_event_with_mode(struct input_event *event, int mode) { - if (event->type == EV_REL || event->type == EV_ABS) - return; - - switch (mode) { - case 0: - if (event->code == KEY_ESC) - event->code = KEY_CAPSLOCK; - break; - case 2: - switch (event->code) { - case KEY_ESC: - event->code = KEY_GRAVE; - break; - case KEY_GRAVE: + if (event->type == EV_KEY) + switch (mode) { + case 0: + if (event->code == KEY_ESC) event->code = KEY_CAPSLOCK; - break; - } - break; - } + break; + case 2: + switch (event->code) { + case KEY_ESC: + event->code = KEY_GRAVE; + break; + case KEY_GRAVE: + event->code = KEY_CAPSLOCK; + break; + } + break; + } write_event(event); }