swap-keys is an Interception Tools plugin that swaps arbitrary pairs of keys.
For more information about the Interception Tools, check the project's website.
mkdir build
cd build
cmake ..
makeSpecify any number of pairs of named keys to swap as command line arguments.
The list of key names can be found in the libevdev source code, look for
constants with the prefix KEY_:
A typical use case is to swap WIN and ALT keys. A suggested udevmon job
configuration for this is:
- JOB: "intercept -g $DEVNODE | swap-keys KEY_LEFTALT KEY_LEFTMETA KEY_RIGHTALT KEY_RIGHTMETA | uinput -d $DEVNODE"
DEVICE:
NAME: Apple Inc. Apple Keyboard
EVENTS:
EV_KEY: [KEY_LEFTALT, KEY_RIGHTALT, KEY_LEFTMETA, KEY_RIGHTMETA]