Two days ago I've had the chance to set up another Laptop using Ubuntu and configure it properly for my workflows. I've plugged in my Keychron K8 and recognized that the F1-F12 keys won't get registered as actual function keys. Instead, my device just treated them as multimedia keys by default. I have found a GitHub Gist with a solution but I will write it down here anyway for the sake of documentation.
Here is how to fix it:
The Keychron keyboard has 2 modes: Windows/Android and macOS, but neither mode worked properly out of the box on the Linux machine.
Steps to use the F1-F12 keys as function keys:
- Set the keyboard mode to the "Windows/Android" mode via the side switch
- Use
Fn + X + L
(hold for ~4 seconds) to set the function key row to “Function” mode. (usually all that’s necessary on Windows) - Execute:
echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode
Each number stands for different behavior. The complete documentation can be found here, but I will paste the relevant section into this post:
0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave like you only press 'F8'
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.
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: This change is not persistent yet. It will work until you reboot your system. Right now you can test the changes before you apply this permanently.
To persist this change, add a module option for hid_apple
:
echo "options hid_apple fnmode=0" | sudo tee -a /etc/modprobe.d/hid_apple.conf
If hid_apple
is already included you may need to rebuild your initramfs
.
update-initramfs -u -k all
After that, you should be able to use your Keychron Keyboard properly. Even after a reboot.