I’ve been playing around with mapping scancodes to keycodes, it’s the better option so we’ll do it this way.
First open a terminal and install
sudo pacman -S evtest
You will be asked for your password, type it in and press Enter(you won’t be able to see what you’re typing). Then confirm you want to install by pressing Enter again.
It will display a list of devices and their corresponding event numbers. Find your keyboard in the list, and type the event number followed by Enter.
Press Z and you should see something like this.
Event: time 1654467466.446422, type 4 (EV_MSC), code 4 (MSC_SCAN), value 2c
Event: time 1654467466.446422, type 1 (EV_KEY), code 44 (KEY_Z), value 1
Event: time 1654467466.446422, -------------- SYN_REPORT ------------
We need the scancode (the value field for MSC_SCAN) which in my case is
2c, yours may be different. Also get the scancode for Numpad 6 which for me is
Event: time 1654505070.826956, type 4 (EV_MSC), code 4 (MSC_SCAN), value 4d
Event: time 1654505070.826956, type 1 (EV_KEY), code 77 (KEY_KP6), value 0
Event: time 1654505070.826956, -------------- SYN_REPORT ------------
Press Ctrl + C to exit.
Then create the configuration file.
sudo nano /etc/udev/hwdb.d/10-remap-z.hwdb
evdev:atkbd:dmi:* # built-in keyboard: match all AT keyboards for now
KEYBOARD_KEY_2c=reserved # bind z to nothing
KEYBOARD_KEY_4d=z # bind kp6 to z
If necessary edit the scancodes (2c, 4d) to match yours. Make sure the
KEYBOARD_KEY lines are indented by exactly 1 space.
Press Ctrl + X followed by Y and then Enter to save and exit.
Run these commands.
sudo systemd-hwdb update
sudo udevadm trigger
Test your keys.