How to use a Keychron K2/K4 USB keyboard on Linux

Software keyboard, linux

I recently bought a Keychron K2 mechanical keyboard and it’s been great so far. Most things work out of the box on my Linux laptop with a few notable exceptions:

Keychron K2

The issue with function keys:

The solution is simple:

You’ll need to reboot (or unplug the keyboard, unload the module, reload it with the correct options, and plug the keyboard), and voilĂ , it works :)

Now, for the lack of Insert key. I mostly use it in the Shift+Insert combination to paste things from the X primary selection.

The simplest solution I found is to use xmodmap to map Shift+Delete (which I never use) to Shift+Insert. To do that, I created ~/.Xmodmap with the following content:

keycode 119 = Delete Insert Delete Insert

And added this to my ~/.xinitrc:

# Load .Xmodmap if it exists
[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap

There’s also a list of resources for Keychron K2 Linux users in this Git repo, and on Facebook Keychron created a Keychron Linux User Group.

EDIT: everything in this post also applies to the Keychron K4 keyboard.