How do I install caps2esc?

I am switching back from mac-land, and the thing that bugs me the most about linux these days is the keybindings. Specifically, right now, I miss Karabiner, and the ability to turn the caps lock both into control and escape at the sametime.

Luckily, I found caps2esc. Unluckily, I don't quite understand how to install it.

I found the way to compile and make install both interception tools and caps2esc. But now it seems I need to mess around with systemd? Now I'm lost.

Help?

Here's the relevant documentation:

  1. https://gitlab.com/interception/linux/plugins/caps2esc

  2. https://gitlab.com/interception/linux/tools/blob/master/README.md


Solution 1:

I think I mostly figured this out.

  1. Follow the instructions to cmake, make, sudo make install
  2. On Ubuntu/Debian, these executables are now in /usr/local/bin/caps2esc
  3. sudoedit /etc/udevmon.yaml and then put this in:

    - JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
      DEVICE:
        EVENTS:
          EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
    
  4. sudoedit /etc/systemd/system/udevmon.service and put this in:

    [Unit]
    Description=udevmon
    Wants=systemd-udev-settle.service
    After=systemd-udev-settle.service
    
    [Service]
    ExecStart=/usr/bin/nice -n -20 /usr/bin/udevmon -c /etc/udevmon.yaml
    
    [Install]
    WantedBy=multi-user.target
    
  5. sudo systemctl enable --now udevmon

Solution 2:

I've lightly adapted a guide to installing the sister application dual-function-keys on this page. I managed to follow the steps in the OP's answer and the comments with some trial and erorr, but this guide puts it all together in order.

# install build deps
$ sudo apt install libudev-dev libyaml-cpp-dev libevdev-dev cmake
# create a folder where to clone the source code
$ mkdir src && cd src
# clone the necessary code
$ git clone https://gitlab.com/interception/linux/tools
$ git clone https://gitlab.com/interception/linux/plugins/caps2esc
# build and install the interception framework
$ cd tools
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ cd ../..
# build the caps2esc plugin
$ cd caps2esc
$ make && sudo make install

After the installation make and edit the two configuration files as in the OP's answer, changing the path to the install location if necessary.