If you have problem getting the F1 - F12 (Function) keys to work, and unstable bluetooth connection on your new Keychron K5 keyboard, this will hopefully help you.
Here are the fixes that worked for me on Ubuntu 22.04.
So you can actually use the function key row as function keys:
- Set keyboard to Windows mode (use hardware switch)
- Hold Fn + X + L for 4 seconds to switch to "Function" mode
Apply the fix temporarily --> check if it's working:
echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode
Apply the fix permanently:
echo "options hid_apple fnmode=0" | sudo tee -a /etc/modprobe.d/hid_apple.conf sudo update-initramfs -u
Reboot (to verify)
Before this fix the keyboard would randomly disconnect.
After this fix, not a single glitch the entire workday 😋
Enable fast connect:
/etc/bluetooth/main.conf- uncomment and set these values:
FastConnectable = true ReconnectAttempts=7 ReconnectIntervals=1, 2, 4
Disable bluetooth auto suspend
echo "options btusb enable_autosuspend=n" | sudo tee /etc/modprobe.d/btusb_disable_autosuspend.conf sudo update-initramfs -u
sudo modprobe -r btusb sudo systemctl restart bluetooth sudo modprobe btusb
Factory reset keyboard (Hold Fn + Z + J for 4 seconds) --> Re-pair keyboard
This makes no sense but it did seem to make a difference...
This post is possible thanks to these awesome people: