Keychron K2 setup on linux

get the function keys working as they should in the current session by running:

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

Run

echo options hid_apple fnmode=2 | sudo tee /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u
reboot

if update-initramfs is not available just run sudo mkinitcpio -P to make the effect permanent

other useful tips can be found in this github repository