(Top)
Keyd was by far the most intuitive and painless among the many input remapping methods I’ve tried, while also being powerful. It can not only remap keys, but also has an easy and flexible layer system, macros, key timing, and even mouse inputs.
Description
keyd is a system wide key remapping daemon which supports features like layering, oneshot modifiers, and macros. In its most basic form it can be used to define a custom key layout that persists across display server boundaries (e.g wayland/X/tty).
The program runs in the foreground, printing diagnostic information to the standard output streams, and is intended to be run as a single instance managed by the init system.
NOTE:
Because keyd modifies your primary input device, it is possible to render your machine unusable with a bad config file. If you find yourself in this situation the panic sequence <backspace>+<escape>+<enter> will force keyd to terminate.
From keyd(1) manual
Installation
There is a COPR repository for keyd, but
it didn’t make the proper directories (e.g. /etc/keyd
)
by default, so I opted to compile from source as recommended by the
README.
git clone https://github.com/rvaiya/keyd # --branch v2.5.0
cd keyd
make && sudo make install
sudo systemctl enable keyd && sudo systemctl start keyd
This installs to /usr/local/keyd
.
To uninstall:
sudo systemctl stop keyd && sudo systemctl disable keyd
sudo make uninstall
Configuration
Finding device ids and key names
sudo keyd monitor
Mapping capslock
capslock
tohangeul
ctrl
+capslock
for changing input sources
# /etc/keyd/default.conf
[ids]
<keyboard id>
[main]
capslock = hangeul
[control]
# for changing input sources (e.g. japanese)
# equivalent to macro(leftmeta+space)
capslock = M-space
Using second layer on Logitech G304
# /etc/keyd/g304.conf
[ids]
<mouse id>
[main]
mouseforward = layer(gshift)
[gshift]
leftmouse = macro(leftcontrol+leftalt+up)
...