How to find keycodes for Fn + keys?

Solution 1:

I'm not sure how much of this is perfectly clear to you:

To show the keycodes of the pressed keys, you can use e.g. sudo showkey -k. This will print in my case for Fn+:

keycode 165 press
keycode 165 release

On my keyboard, this is one of the media keys (previous track). The same for Fn+Del shows 70 as the keycode here (Scroll lock).

Now the general problem with this seems to be that Fn can be be a modifier key that works on the keybord level and modifies the actual scan code that is send. So you might not be able at all to know if Fn is pressed, since no part of the OS or BIOS is able to see it. If this is not the case, then the BIOS might be able to see that this key was pressed. Some hardware manufacturers provide software that can be used to modify the behaviour of the Fn key this way (e.g. Toshibas Fnesse).

So: in general there is no way to know that Fn was pressed and the scancode and the keycode of key-combinations including Fn depends on the individual keyboard design.