3 Commits

Author SHA1 Message Date
27efcbbf96 Fix #4: Correctly follows evdev protocol
SYN events and different event timestamps are necessary for sending
sequential key events of the same key.
2017-11-29 23:59:07 -02:00
6fa3ad14b3 Fix README build instructions 2017-11-24 13:33:03 -02:00
40137670a4 Fix link 2017-08-13 14:25:50 -03:00
2 changed files with 8 additions and 6 deletions

View File

@ -4,9 +4,7 @@ _Transforming the most useless key **ever** in the most useful one._
<sub>_For vi/Vim/NeoVim addicts at least_.</sub> <sub>_For vi/Vim/NeoVim addicts at least_.</sub>
<a href="http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/"> <a href="http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/">
<img src="http://www.catonmat.net/images/why-vim-uses-hjkl/lsi-adm3a-full-keyboard.jpg" alt="ADM-3A terminal">
![ADM-3A terminal](http://www.catonmat.net/images/why-vim-uses-hjkl/lsi-adm3a-full-keyboard.jpg)
</a> </a>
## What is it? ## What is it?
@ -28,8 +26,8 @@ ESC when pressed alone is quite handy, specially in vi.
## Building ## Building
``` ```
$ git clone git@gitlab.com:interception/linux/tools.git $ git clone git@gitlab.com:interception/linux/plugins/caps2esc.git
$ cd tools $ cd caps2esc
$ mkdir build $ mkdir build
$ cd build $ cd build
$ cmake .. $ cmake ..

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <linux/input.h> #include <linux/input.h>
// clang-format off // clang-format off
@ -13,7 +14,8 @@ ctrl_down = {.type = EV_KEY, .code = KEY_LEFTCTRL, .value = 1},
capslock_down = {.type = EV_KEY, .code = KEY_CAPSLOCK, .value = 1}, capslock_down = {.type = EV_KEY, .code = KEY_CAPSLOCK, .value = 1},
esc_repeat = {.type = EV_KEY, .code = KEY_ESC, .value = 2}, esc_repeat = {.type = EV_KEY, .code = KEY_ESC, .value = 2},
ctrl_repeat = {.type = EV_KEY, .code = KEY_LEFTCTRL, .value = 2}, ctrl_repeat = {.type = EV_KEY, .code = KEY_LEFTCTRL, .value = 2},
capslock_repeat = {.type = EV_KEY, .code = KEY_CAPSLOCK, .value = 2}; capslock_repeat = {.type = EV_KEY, .code = KEY_CAPSLOCK, .value = 2},
syn = {.type = EV_SYN, .code = SYN_REPORT, .value = 0};
// clang-format on // clang-format on
int equal(const struct input_event *first, const struct input_event *second) { int equal(const struct input_event *first, const struct input_event *second) {
@ -55,6 +57,8 @@ int main(void) {
continue; continue;
} }
write_event(&esc_down); write_event(&esc_down);
write_event(&syn);
usleep(20000);
write_event(&esc_up); write_event(&esc_up);
continue; continue;
} }