4

Can anyone please tell me how to read the current state of the Fn-key in Linux? Is the current state of my keyboard in "Fn" mode or "normal" mode? I know that I can find out by pressing the keys, but I rather know before I try out.

I just can't find any device or /proc or mapping or whatever, where I can find out if pressing Fn-F1 produces a "sound off" (configured in my case) or triggers the F1-action bound on the F1 key.

phuclv
  • 30,396
  • 15
  • 136
  • 260
CFrei
  • 93

2 Answers2

3

It's not possible to do that on most common hardware, because the Fn key is completely unknown to the outside world except the keyboard controller and doesn't generate any scan code when pressing. Only when you hold it down in conjunction with another key then the keyboard controller will send the final scan code to the OS

There are some platforms where you can capture the Fn key status such as macOS or some custom boards. Everything is different on a Mac, even the Power button generates a scan code on it. If you aren't on such platforms, you're out of luck

But if you just want to get the function keys without pressing Fn then simply go into BIOS setup and change the setting to invert Fn behavior, most have that option along with the config to swap Fn/Ctrl keys. If there's no such option then you need to update the BIOS. You can also use the Fn-lock key on your keyboard if it's available

If there's a secondary option on F1 then you can also remap that combo to your desired action, for example if Fn+F1 produces the Volume down key then remap Volume down to the "sound off" action you want

phuclv
  • 30,396
  • 15
  • 136
  • 260
2

You generally can't. The Fn key works entirely in hardware, unlike modifier keys like Ctrl or Shift. You can find more information on the Fn Key wikipedia.

phuclv
  • 30,396
  • 15
  • 136
  • 260
Silbee
  • 1,549
  • 8
  • 12