How to remap left alt to send escape when pressed alone in ubuntu

From razwiki
Jump to navigation Jump to search

Start with https://wiki.abuissa.net/wiki/How_to_get_intercept-tools_to_work

Then use https://github.com/zsugabubus/interception-k2k

$ cat default/interception-framework-keyboard/tap-rules.h.in
/* Caps2esc */
{ .base_key = KEY_LEFTALT, .tap_key = KEY_ESC, .repeat_key = KEY_LEFTALT, .hold_key = KEY_LEFTALT, .hold_immediately = 1 },
{ .base_key = KEY_CAPSLOCK, .repeat_key = KEY_LEFTCTRL, .hold_key = KEY_LEFTCTRL, .hold_immediately = 1 },
/* vi:set ft=c: */
make
sudo make install

Then add to /etc/interception/udevmon.yaml

- JOB: intercept -g $DEVNODE | /opt/interception/interception-framework-keyboard | uinput -d $DEVNODE
  DEVICE:
    NAME: AT Translated Set 2 keyboard

Finally restart udevmon:

sudo systemctl restart udevmon.service