Remapping Copilot Key to Ctrl Key in Linux

Microsoft is shoving Copilot into every corner of the Windows ecosystem, and has decided to put a dedicated key on the keyboard for it. If you’re using such a keyboard in Linux, you might want to replace the Copilot key with something more useful, like the good old Ctrl key.

Keyd is a key remapping daemon for Linux using a flexible system-wide daemon which remaps keys using kernel level input primitives (evdev, uinput). Keyd works in both graphical environments, like X11 and Wayland, and the Linux virtual console.

1 - Check the Copilot Key Code

First, you need to find the key code of the Copilot key. You can use the evtest to find the key code. Install evtest using your package manager, then run the following command:

sudo evtest

Select the device that corresponds to your keyboard, then press the Copilot key. You should see the key code in the output. The key code for the Copilot key can be different depending on the keyboard model. There’s one of the possible outputs:

Event: time 1735439949.475439, -------------- SYN_REPORT ------------
Event: time 1735439950.628258, type 4 (EV_MSC), code 4 (MSC_SCAN), value db
Event: time 1735439950.628258, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1735439950.628258, -------------- SYN_REPORT ------------
Event: time 1735439950.628383, type 4 (EV_MSC), code 4 (MSC_SCAN), value 2a
Event: time 1735439950.628383, type 1 (EV_KEY), code 42 (KEY_LEFTSHIFT), value 1

Which shows that the Copilot key on this keyboard is KEY_LEFTMETA with KEY_LEFTSHIFT pressed.

2 - Install Keyd

Use your package manager to install keyd. Then start the service and enable it to run on boot.

sudo systemctl enable --now keyd

3 - Create a Keyd Configuration File

Create a configuration file for Keyd in /etc/keyd/default.conf:

sudo vim /etc/keyd/default.conf

Add the following content to the file if the Copilot key is KEY_LEFTSHIFT + KEY_LEFTMETA:

[ids]

*

[main]
leftshift+leftmeta = layer(control)

4 - Restart Keyd

Restart the Keyd service to apply the changes:

sudo keyd reload

Now, the Copilot key should act as the Ctrl key on system. To test the changes, you can use evtest tool again to verify the key code. Now your input device should be taken over by Keyd like this:

No device specified, trying to scan all of /dev/input/event*
Available devices:
...
/dev/input/event10:     keyd virtual keyboard
/dev/input/event11:     keyd virtual pointer
...
Select the device event number [0-15]:

Choose the keyd virtual keyboard device and press the Copilot key. You should see the key code for the Ctrl key in the output.

Issues

Keyd can only map keys to the left Ctrl key, which may or may not be a problem for you. If you really need to map the Copilot key to the right Ctrl key, kmonad is an alternative solution that offers advanced customization features, but requires more manual configuration.