Configuring my AKKO 3068BT keyboard directly on the X window manager
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:
- This configuration is lost if I unplug the keyboard and I have to re-run
xmodmap ~/.Xmodmap
. It also requires that I runstartx
manually from a TTY; it did not work when I logged in via SDDM, my previous display manager. I currently do this each time I log in and no longer run a display manager. - This requires that I have X running to work. If I were just to use the keyboard in a TTY, neither of my tweaks would apply.
- This configuration is machine-local: I would not get the same settings if I were to plug my keyboard into another machine.
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.