mirror of
https://github.com/RecentRunner/interception-vimproved-personal.git
synced 2026-06-04 16:19:18 -06:00
chore: Rename. Extended udevmon.yml example.
This commit is contained in:
committed by
Nikola Marić
parent
6d0c725abe
commit
ab78ad1bab
2
Makefile
2
Makefile
@@ -4,7 +4,7 @@ TIMEOUT ?= 10
|
|||||||
INSTALL_FILE := /opt/interception/interception-vimproved
|
INSTALL_FILE := /opt/interception/interception-vimproved
|
||||||
|
|
||||||
# the build target executable:
|
# the build target executable:
|
||||||
TARGET = remap
|
TARGET = interception-vimproved
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
|||||||
72
README.md
72
README.md
@@ -11,12 +11,78 @@ My hideous (but working and performant) C++ code to remap the keys on any input
|
|||||||
Basically any OS that works with `libevdev` (linux with kernel newer than 2.6.36), no matter what desktop environment, or even if any DE is used (yes, it works the same in X server instead of `xmodmap`, but also in plain terminal, without graphical environment).
|
Basically any OS that works with `libevdev` (linux with kernel newer than 2.6.36), no matter what desktop environment, or even if any DE is used (yes, it works the same in X server instead of `xmodmap`, but also in plain terminal, without graphical environment).
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
Use it with a job specification for `udevmon` (from [Interception Tools](https://gitlab.com/interception/linux/tools)). I install `remap` to `/opt/interception/interception-vimproved` and use it like the following on Arch linux on Thinkpad x1c gen7.
|
Use it with a job specification for `udevmon` (from [Interception Tools](https://gitlab.com/interception/linux/tools)). I install the binary to `/opt/interception/interception-vimproved` and use it like the following on Arch linux on Thinkpad x1c gen7.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- JOB: "intercept -g $DEVNODE | /opt/interception/interception-vimproved | uinput -d $DEVNODE"
|
- JOB: "intercept -g $DEVNODE | /opt/interception/interception-vimproved | uinput -d $DEVNODE"
|
||||||
DEVICE:
|
DEVICE:
|
||||||
NAME: "AT Translated Set 2 keyboard"
|
EVENTS:
|
||||||
|
EV_KEY:
|
||||||
|
[
|
||||||
|
KEY_SPACE,
|
||||||
|
|
||||||
|
KEY_1,
|
||||||
|
KEY_2,
|
||||||
|
KEY_3,
|
||||||
|
KEY_4,
|
||||||
|
KEY_5,
|
||||||
|
KEY_6,
|
||||||
|
KEY_7,
|
||||||
|
KEY_8,
|
||||||
|
KEY_9,
|
||||||
|
KEY_0,
|
||||||
|
KEY_MINUS,
|
||||||
|
KEY_EQUAL,
|
||||||
|
KEY_F1,
|
||||||
|
KEY_F2,
|
||||||
|
KEY_F3,
|
||||||
|
KEY_F4,
|
||||||
|
KEY_F5,
|
||||||
|
KEY_F6,
|
||||||
|
KEY_F7,
|
||||||
|
KEY_F8,
|
||||||
|
KEY_F9,
|
||||||
|
KEY_F10,
|
||||||
|
KEY_F11,
|
||||||
|
KEY_F12,
|
||||||
|
|
||||||
|
KEY_B,
|
||||||
|
KEY_BACKSPACE,
|
||||||
|
|
||||||
|
KEY_E,
|
||||||
|
KEY_ESC,
|
||||||
|
|
||||||
|
KEY_D,
|
||||||
|
KEY_DELETE,
|
||||||
|
|
||||||
|
KEY_Y,
|
||||||
|
KEY_U,
|
||||||
|
KEY_I,
|
||||||
|
KEY_O,
|
||||||
|
KEY_HOME,
|
||||||
|
KEY_PAGEDOWN,
|
||||||
|
KEY_PAGEUP,
|
||||||
|
KEY_END,
|
||||||
|
|
||||||
|
KEY_H,
|
||||||
|
KEY_J,
|
||||||
|
KEY_K,
|
||||||
|
KEY_L,
|
||||||
|
KEY_LEFT,
|
||||||
|
KEY_DOWN,
|
||||||
|
KEY_UP,
|
||||||
|
KEY_RIGHT,
|
||||||
|
|
||||||
|
KEY_M,
|
||||||
|
KEY_COMMA,
|
||||||
|
KEY_DOT,
|
||||||
|
KEY_MUTE,
|
||||||
|
KEY_VOLUMEDOWN,
|
||||||
|
KEY_VOLUMEUP,
|
||||||
|
|
||||||
|
KEY_CAPSLOCK,
|
||||||
|
KEY_LEFTCTRL,
|
||||||
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, you can run it with `udevmon` straight, just make sure to be negatively nice (`nice -n -20 udevmon -c /etc/udevmon.yml`) so your input is always available.
|
Alternatively, you can run it with `udevmon` straight, just make sure to be negatively nice (`nice -n -20 udevmon -c /etc/udevmon.yml`) so your input is always available.
|
||||||
@@ -34,7 +100,7 @@ sleep 1 && timeout 10 udevmon -c /etc/udevmon.yml
|
|||||||
1. I have problems switching back and forth between my external keyboard and laptop keyboard. I customized my external keyboard with QMK to reduce my pinky strain and improve usability, but when I switch back to laptop keyboard, it's all lost, plus I have to fight my muscle memory.
|
1. I have problems switching back and forth between my external keyboard and laptop keyboard. I customized my external keyboard with QMK to reduce my pinky strain and improve usability, but when I switch back to laptop keyboard, it's all lost, plus I have to fight my muscle memory.
|
||||||
2. I used to use X.Org server with xinput, where I had an [xkbcomp based solution with xcape and xmodmap](https://github.com/maricn/dotfiles/blob/master/.xinitrc-keyboard-remap). However, since moving to wayland, that solution doesn't work anymore, and I needed to move to `libevdev` based solution.
|
2. I used to use X.Org server with xinput, where I had an [xkbcomp based solution with xcape and xmodmap](https://github.com/maricn/dotfiles/blob/master/.xinitrc-keyboard-remap). However, since moving to wayland, that solution doesn't work anymore, and I needed to move to `libevdev` based solution.
|
||||||
3. Enter [Interception Tools](https://gitlab.com/interception/linux/tools). It advertises itself as "a minimal composable infrastructure on top of libudev and libevdev". It, on one side, intercepts events from devices and writes them raw to `stdout`, and on the other side, it receives events from `stdin` and writes them to virtual input device.
|
3. Enter [Interception Tools](https://gitlab.com/interception/linux/tools). It advertises itself as "a minimal composable infrastructure on top of libudev and libevdev". It, on one side, intercepts events from devices and writes them raw to `stdout`, and on the other side, it receives events from `stdin` and writes them to virtual input device.
|
||||||
4. This plugin sits piped between Interception Tool's `intercept` and `uinput` (`intercept | remap | uinput`). It interprets input from `intercept` and maps it to desired events which are then passed to `uinput` for emitting.
|
4. This plugin sits piped between Interception Tool's `intercept` and `uinput` (`intercept | interception-vimproved | uinput`). It interprets input from `intercept` and maps it to desired events which are then passed to `uinput` for emitting.
|
||||||
|
|
||||||
* Other solutions I tried didn't behave as expected and produced unexpected artefacts.
|
* Other solutions I tried didn't behave as expected and produced unexpected artefacts.
|
||||||
* In this solution, the use of sleeps is eliminated, there's no buffers for input and the interaction with output is minimized to reduce extra costs of writing to it often.
|
* In this solution, the use of sleeps is eliminated, there's no buffers for input and the interaction with output is minimized to reduce extra costs of writing to it often.
|
||||||
|
|||||||
BIN
interception-vimproved
Executable file
BIN
interception-vimproved
Executable file
Binary file not shown.
@@ -156,6 +156,8 @@ int main() {
|
|||||||
continue;
|
continue;
|
||||||
} else if (input->value !=
|
} else if (input->value !=
|
||||||
KEY_STROKE_UP) { // any key != capslock goes down or repeat
|
KEY_STROKE_UP) { // any key != capslock goes down or repeat
|
||||||
|
// TODO: find a way to have a mouse click mark caps as ctrl
|
||||||
|
// or just make it time based
|
||||||
caps_is_esc = false;
|
caps_is_esc = false;
|
||||||
if (ctrl_not_emitted) {
|
if (ctrl_not_emitted) {
|
||||||
event ctrl_down = {.time = {.tv_sec = 0, .tv_usec = 0},
|
event ctrl_down = {.time = {.tv_sec = 0, .tv_usec = 0},
|
||||||
Reference in New Issue
Block a user