How to swap Ctrl and Fn on a Lenovo Thinkpad keyboard?

I tried to exchange my Fn key with left Control, which didn't work.

I used the command xev to get the keycodes/keysym.

Afterwards I used:

xmodmap -e 'keycode 151=Control_L'
xmodmap -e 'keycode 37=XF86WakeUp'

But it didn't change anything.

I also couldn't create the .Xmodmap to change the keys there.

Did I forget anything? It didn't throw out an error.


Solution 1:

If you are using a Lenovo or Thinkpad laptop, see into BIOS/UEFI config to check whether there is a "Swap Fn and Ctrl" option in "Keyboard" section. According to the user guide, most models should have that option.

Solution 2:

You are probably using a Lenovo keyboard, which reports the Fn as XF86WakeUp. Normally Fn does not register an xev event at all because it is handled by the BIOS, therefore you cannot remap it.

The fact that it is reported as XF86WakeUp gives a lot of confusion, as you can see in this bug report, but it is not really a bug, to quote comment 27 of that bug report:

It's not really a bug. Fn is the wakeup key when the machine is suspended. If anyone wants to map it to other functions, then that's okay, but being able to do that is not universal... Fn on ThinkPads and LenovoPads is a magical/special key. If only generates its own code if not combined with any of the other magic (blue highlighted) key combinations and that is more of a fluke than anything.