14

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

3 Answers3

17

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/local/bin/udevmon -c /etc/udevmon.yaml

    [Install] WantedBy=multi-user.target

  5. sudo systemctl enable --now udevmon

Bendik
  • 103
1

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.

0

After spending too much time on udevmon configuration in ubuntu 22.04, here's my gotcha.

First you need to install interception-tools and interception-caps2esc packages:

sudo apt install interception-tools interception-caps2esc 

Config file is located at /etc/interception/udevmon.yaml. If you check package info apt show interception-tools, you'll see that:

The upstream command name 'intercept' is renamed to 'interception' in this package to avoid the name collision. If you wish to use command names which the upstream uses, please install the interception-tools-compat package.

So to make it work, you need to create /etc/interception/udevmon.yaml and change intercept to interception:

- JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
  DEVICE:
    EVENTS:
      EV_KEY: [KEY_CAPSLOCK, KEY_ESC]

Then restart service with systemctl restart udevmon and you're good to go.

Alexander
  • 101