Ubuntu – How to find keycodes for Fn + keys

11.10keycodesshortcut-keys

I'm trying to find out the keycode for Fn+ keypress (left arrow). Xev outputs

FocusOut event, serial 36, synthetic NO, window 0x3c00001,    mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 36, synthetic NO, window 0x3c00001,    mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 36, synthetic NO, window 0x0,    keys:  4294967213 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0              0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0  

If it is telling me the keycode here, I'm not able to interpret it so help would be appreciated.

I'm also curious for finding out if it's possible to bind something to Fn+Del but when trying out this combination, Xev outputs

KeyPress event, serial 36, synthetic NO, window 0x3c00001,
root 0xad, subw 0x0, time 1984903, (-666,480), root:(53,533),
state 0x0, keycode 119 (keysym 0xffff, Delete), same_screen YES,
XLookupString gives 1 bytes: (7f) " "
XmbLookupString gives 1 bytes: (7f) " "
XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x3c00001,
root 0xad, subw 0x0, time 1985008, (-666,480), root:(53,533),
state 0x0, keycode 119 (keysym 0xffff, Delete), same_screen YES,
XLookupString gives 1 bytes: (7f) " "
XFilterEvent returns: False

which is exactly the same as pressing del without Fn.

So, summary for short

  1. How can I find keycode for Fn+ (left arrow)?

  2. Is it even possible to bind something to Fn+Del or am I facing windmills here?

Best Answer

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.

Related Question