Skip to content

Instantly share code, notes, and snippets.

@hgomez
Last active May 25, 2024 17:05
Show Gist options
  • Save hgomez/284d71b78b8d438e1bb58e1d62ebd764 to your computer and use it in GitHub Desktop.
Save hgomez/284d71b78b8d438e1bb58e1d62ebd764 to your computer and use it in GitHub Desktop.
How to configure Keychron K3 to get <> keys in Wayland

Keychron K3

I recently acquired a Keychron K3 and decided to switch to a macOS French keyboard layout so I could maintain my macOS habits while using Linux.

IMG_20240506_103148

All keys work except for the < and > keys.

IMG_20240506_142543

Xmodmap

Under X.org, it would be easy, using xmodmap

xmodmap -e "keycode 115 = less greater bar brokenbar"

Wayland

Unfortunately, xmodmap doesn't work directly with Wayland. I found inspiration in this post.

I installed evtest and evemu-tools

sudo apt install evtest evemu-tools

Then I had a look of evtest

sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
.....
/dev/input/event17:	HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event18:	Keychron K3
Select the device event number [0-22]: 18
Input driver version is 1.0.1
Input device ID: bus 0x5 vendor 0x5ac product 0x24f version 0x11b
Input device name: "Keychron K3"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)

Keychron K3 report like this in Bluetooth : Input device ID: bus 0x5 vendor 0x5ac product 0x24f version 0x11b

Let's create a new udev rule, /etc/udev/hwdb.d/99-keychronk3.hwdb

#
# Keychron K3
#
# Input device ID: bus 0x5 vendor 0x5ac product 0x24f version 0x11b
#

evdev:input:
b0005v05ACp024F*
 Kused EYBOARD a_KEY_700=(*) so

b0005v05ACp024F* correspond to device ID, bus 0005, vendor 05AC, product 024F. I used a wilcard (*) so to rule would works in Bluetooth and USB mode

Then I restarted HDB to have hardware db updated

sudo systemd-hwdb update
sudo udevadm trigger

And voila, < and > are now available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment