Linux Keyboard – Make Function Keys Work Without fn Modifier on Apple Keyboard

applekeyboardkeyboard-layoutlinux

I use an Apple wired keyboard on Linux. By default the function keys (F1, F2, F3, etc) require the fn key to be pressed for them to work. Without the fn key, these keys control the features like Screen Brightness, Volume, and Music Track Control.

Is there any way to swap these around, so the Function keys do not require the fn modifier, but the other functions (Brightness etc) do?

Best Answer

You need to add 0 or 2 into /sys/module/hid_apple/parameters/fnmode.

i.e.:

echo 2 > /sys/module/hid_apple/parameters/fnmode

There seems to be some confusion regarding what the difference between the two values might be. Quoting the Ubuntu documentation:

  1. 0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave like you only press 'F8'
  2. 1 = fkeyslast : Function keys are used as last key. Pressing 'F8' key will act as a special key. Pressing 'fn'+'F8' will behave like a F8.
  3. 2 = fkeysfirst : Function keys are used as first key. Pressing 'F8' key will behave like a F8. Pressing 'fn'+'F8' will act as special key (play/pause).

Note that this also works for me on Fedora.


As several people have commented, this change is temporary. You can stick it in your login shell's RC file or into cron so that you don't have to worry about it.

You can also change your driver settings to make this change permanent, like so:

echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
# reboot when convenient

credits to https://askubuntu.com/a/7553

Related Question