Karabiner for Linux? [closed] Karabiner for Linux? [closed] linux linux

Karabiner for Linux? [closed]


You can achieve this on Waylan, a TTY or X11 using Interception Tools, which talks directly with libevdev and libudev.

Wayland, TTY or X11

Install Interception Tools and a plugin such as caps2esc or interception-k2k. Then you need to configure Interception to use this plugin. For caps2esc, you can use the following /etc/udevmon.yaml file:

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

Then run it as root:

nice -n -20 /usr/bin/udevmon -c /etc/udevmon.yaml

You should make sure it starts on login. For systemd, you can use the following service:

[Unit]Description=udevmon[Service]ExecStart=/usr/bin/nice -n -20 /usr/bin/udevmon -c /etc/udevmon.yaml[Install]WantedBy=multi-user.target

X11-only

As an alternative or on older systems without udev, you can use setxkbmap and xcape.

First change Caps Lock to act as a Ctrl modifier:

setxkbmap -option caps:ctrl_modifier

Then set Caps Lock to act as Menu key when pressed for less than the timeout (the default is 500 ms):

xcape -e 'Caps_Lock=Menu'

xcape runs as a daemon, so you need to ensure it starts on login. setxkbmap sets the keyboard layout for the current X session only, you can set it permanently on xinitrc, xprofile or X configuration files.


P.S. For those that want to use an external keyboard, the open source (software and hardware) Ultimate Hacking Keyboard (UHK) allows this functionality.