12

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

  • 1
    to really help I'd have to run it, and sorry i'm not doing that. a quick scan-read of files however and I don't see the need of sysd except if you want it to auto-run every boot or use system (systemctl) commands to stop/restart/start/.. it (which would be nicer yes) but are not necessary from my read. – guiverc Nov 23 '17 at 06:09

2 Answers2

16

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

oblitum
  • 1,677
  • 2
  • 16
  • 27
  • 4
    When I ran `sudo make install` on interception tools, it installed `udevmon` to `/usr/local/bin/udevmon`. I changed the reference in `/etc/systemd/system/udevmon.service` from `/usr/bin/udevmon` to `/usr/local/bin/udevmon` and all was well. – Duane J Jul 14 '19 at 22:51
  • 1
    Also note that if you don't already have it ( didn't on Pop!_OS), you'll need to install Interception Tools: https://gitlab.com/interception/linux/tools. The `cmake ..`, `make`, `sudo make install` instructions worked out for that for me as well. – Tom Jan 01 '20 at 19:14
  • 1
    update to add: I also had to install `libyaml-cpp-dev` and `libevdev` to install interception tools. – Tom Jan 01 '20 at 19:22
  • I've also had to install `libevdev-dev`, otherwise I was getting a `interception_tools/uinput.cpp:14:38: fatal error: libevdev/libevdev-uinput.h: No such file or directory`. – Andre Albuquerque Aug 27 '20 at 16:54
  • To recap from the message and comments (any my own experience): 1. `sudo apt install libyaml-cpp-dev libevdev-dev libudev-dev`. 2. Compile and interception-tools following @Tom comment. 3. Install [caps2esc](https://gitlab.com/interception/linux/plugins/caps2esc) (`mkdir build`, `cd build`, `cmake .. `, `make`, `sudo make install`). 4. Create the files `/etc/udevmon.yaml` and `/etc/systemd/system/udevmon.service` as explained above BUT use the path `/usr/local/bin/udevmon` instead of `/usr/bin/udevmon`. 5. `sudo systemctl enable --now udevmon`. – juanjux Oct 28 '20 at 10:17
  • The project already provides simpler Ubuntu instructions and a link to a PPA. – oblitum Apr 02 '21 at 16:36
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.

Norbert-op
  • 13
  • 1
  • 4