HOWTO - Keychron K4/Apple Support Keyboard on Ubuntu MATE

Hey guys!

I have recently bought a Keycron K4 keyboard:

https://www.keychron.com/products/keychron-k4-wireless-mechanical-keyboard?variant=30726319210585

I have noticed that few things didn't work as planned. Like the media keys would work without the use of fn. The control key wouldn't work when I wanted to delete blocks of text.

So I did find a solution that I would like to share with you guys!

So there is a switch on the left side of the keyboard to change between Mac and Windows mode. The best solution that I have found is to switch to Mac mode.

And then it is to load hid_apple module, you can activate this module with modprobe by running modprobe hid_apple as root. I would suggest to run sudo su to run as root in your terminal.

To make my fn key work the same way as my other keyboards:
I ran the following command as su:

echo 2 >> /sys/module/hid_apple/parameters/fnmode

To fix the issue I had with my ctr key, I ran the following command as su:

echo "1" >>/sys/module/hid_apple/parameters/swap_opt_cmd

Those command above, let's you test the configs on your current session.

If it works for you, you can make it permanent this way:

/etc/modprobe.d/hid_apple.conf

options hid_apple fnmode=2 swap_opt_cmd=1

The first command make the fn key work as expected! And the second command is to swap Command and Alt

If you happen to be curious and would like to know what does those option means, you can have a look to the ArchWiki.

https://wiki.archlinux.org/index.php/Apple_Keyboard

That module can be used with any other Apple Keyboard that are supported!

When you are done you can restart your computer and enjoy!

2 Likes

Thanks a lot for sharing this kind of setup :slight_smile:

1 Like