For reasons described in my previous post, I now have to configure keyboard settings directly through X.

Much of this follows the same steps as outlined there regarding finding the device ID of the keyboard and properties by which to match it. For the keyboard, instead of wanting to change acceleration, I wanted to make caps lock an escape key, so I set caps:escape.

$ cat /etc/X11/xorg.conf.d/99-akko-keyboard.conf
Section "InputClass"
  Identifier "AKKO 3068BT Keyboard"
  MatchIsKeyboard "on"
  MatchProduct "AKKO 3068BT"
  Option "XkbOptions" "caps:escape"
EndSection

The other modification I want to make is swapping escape with tilde/backtick. My 68 key AKKO keyboard has the escape key in place of the tilde/backtick key, but since I’ve assigned caps lock to escape, I want the tilde/backtick key back in the normal place.

Unfortunately, this is weird enough that there is no keyboard option for this. I found a solution with xmodmap.

$ cat ~/.Xmodmap
! Reassign "Esc" to grave/asciitilde.
keycode   9 = grave asciitilde grave asciitilde
! We don't care about the assigning grave/asciitilde back to Esc.

This is then loaded through the following snippet of my xinitrc:

usermodmap=$HOME/.Xmodmap
# ...
if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

This setup unfortunately has several downsides:

Really what I want is to be able to set functions of keys via the firmware, so everything is local to the keyboard. This is something that I’ll look for in future keyboards.