How can i find out if the user has pressed the FN key?

How can i find out if the user has pressed the FN key ?

For example when i press FN+DELETE, i get a KeyPress event with .Modifiers=0 and .KeyCode=0 and .KeyFunc=0 …

But when i press only DELETE, i get a KeyPress event with .Modifiers=0 and .KeyCode=1286 and .KeyFunc=13 …

If the FN-key is considered as a Modifier key, then why is there no constant for the FN-key among the com.sun.star.awt.KeyModifier constants?

Thanks in advance, lib

Fn generates no event on my laptop. Considering what I’ve done to customise my keyboard and xkb specification, I wonder if Fn is directly handled by keyboard electronics and only the resulting remapping sent to OS driver.

Under Linux, I don’t see Fn with dmesg|tail nor with showkey, but keycode for Fn+key is different from key alone.

In your script, test for the combined keycode without modifier (unless you also press a standard one).

Thanks for your reply @ajlittoz, it is precisely as i experienced too:

  1. the FN-key itself is not registered in ANY key-event, neither as Modifier nor as KeyCode nor as Char,
  2. but pressing the the FN-key can still alter other key-events, like a Modifier does.
    For example if i type FN+p on my keyboard, it generates a .KeyCode=1289 and .KeyChar=*, and prints the character "*" .
    On Wikipedia the FN-key is described as a Modifier Key.

In a way you answered your own question in the link to Wikipedia. It does say Fn is a modifier key but goes on to say that it is a form of meta-modifier key in that it causes the operating system to see altered scancodes when other keys on the keyboard are pressed. It is most common for the Fn key processing to happen directly in the keyboard micro-controller. So the Fn key pressed on its own is meaningless. You need to test for the key codes for the function key that is to be used.

Thank you @peterwt, this definitely answers my question.