User:zaidhaan/caps2esc

From ArchWiki

caps2esc is a program that allows for remapping Caps Lock to Escape and Control. It is a plugin for interception tools that uses libevdev which sits below X and thus does not depend on it. This allows for the applied keybindings to work outside of an X session, such as in virtual consoles.

Installation

Install the interception-caps2esc package.

Configuration

Create the following udevmon job configuration file:

/etc/interception/udevmon.d/caps2esc.yml

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

By default, this remaps the following:

  • Escape as Caps Lock.
  • Caps Lock as Escape when pressed alone and as Ctrl when pressed together with another key.

Next, start/enable udevmon.service.

See also