Keychron Function Keys on Linux
Telling Linux to treat F1-F12 as normal F-keys
Recently I bought a Keychron K5 SE keyboard (with clicky blue optical switches, thank you for asking). When I started using it on an Ubuntu Linux machine, it worked great except one thing: the F1-F12 function keys did not work well. As with so many laptops and other keyboards, they defaulted to their “special” meaning, controlling brightness, volume, that kind of thing. The real issue, though, is that fn + F-key did not work either.
This is due to the Linux kernel recognising the keyboard as an Apple keyboard clone. Fortunately it’s easy to revert that:
echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode
This command should immediately make F-keys register as normal function keys, so F5 actually works as F5. Try pressing it to reload this article!
This fix works immediately, but doesn’t survive reboots. To make the fix permanent:
echo "options hid_apple fnmode=0" | sudo tee /etc/modprobe.d/hid_apple.conf sudo update-initramfs -c -k all # To make sure it's loaded early enough.
I was put on this path by
Jeremy Cheng’s article on the same topic.
Only a minor change was needed (putting
0 there instead of the
2 he uses).
And I needed to add the
update-initramfs command for my Ubuntu install. Thanks