70

To be more clear, right now the volume and brightness keys are used and I have to hold Fn in order to execute an F1, F2, F3, F4, F5... command. Can I reverse this so it's function key by default and holding Fn enables the volume and other special controls?

Artur Meinild
  • 26,018
MetaGuru
  • 1,238

4 Answers4

135

This is described on the Ubuntu Community Wiki:

https://help.ubuntu.com/community/AppleKeyboard#Change_Function_Key_behavior

You can try:

sudo bash -c "echo 2 > /sys/module/hid_apple/parameters/fnmode"

If it works you can change this permanently (per the linked wiki page):

echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
sudo reboot # optional
sroecker
  • 2,560
  • 11
    That link you posted is quite a lot to read. To help future users get to the permanent solution (that doesn't get undone after each reboot) faster, here's the 3 commands you need to type to make this permanent, per the link you posted above: 1) echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf, 2) sudo update-initramfs -u -k all, 3) (optional) sudo reboot. Done! Works for me on my 2008 white MacBook running Xubuntu 16.04 LTS. – Gabriel Staples Mar 20 '17 at 19:55
  • can confirm that it works on MacBook Air 2015 with 16.04 on it – Ege Sucu Mar 28 '18 at 06:47
  • 1
    can confirm that it works on MacBook Pro 2015 with 19.04 on it – Kun Ren Apr 20 '19 at 05:16
  • 3
    worked with Ubuntu 18.04 and the Apple numeric pad wired keyboard – dcalap Mar 17 '20 at 08:22
  • 1
    Not only does this work with Apple keyboards, but also apparently any keyboard that uses the same controller, such as the Varmilo VA87M: https://forums.servethehome.com/index.php?threads/varmilo-keyboard-fn-keys-under-linux.29041/ – joao Jan 10 '21 at 19:04
  • You, Sir, are a life saver! :-) – Saustrup Feb 26 '21 at 22:42
  • Confirmed on Ubuntu 22.04, Dell XPS 15 – Arnaud P Mar 28 '23 at 11:06
4

please try this when editing directly fnmode fails.

echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode

0

On older Apple laptop hardware, this is accomplished by a configuration setting of PBButtonsd. You would need to add this line to the config file /etc/pbbuttonsd.conf:

KBDMode = fkeysfirst  

PBButtonsd works on iBooks and PowerBooks (PowerPC-based) and MacBooks (Intel-based); the native Ubuntu package seems to have disappeared after Dapper Drake

0

it may also be worthwhile to check your BIOS options for this feature. On my Dell Inspiron, this can be set through the BIOS. Hopefully it'll work for your hardware too.

nathwill
  • 2,605