1

I have a MECHREV laptop, /sys/class/dmi/id/product_name "Jiaolong Series GM5ZG0O". Its keyboard has a button for toggling trackpad on/off. However this key emits keycode 93 which is not mapped to anything in /usr/share/X11/xkb/keycodes/evdev which is the auto-configuration Xorg chooses.

I don't want to modify this file because I'm going to lose these changes when xkeyboard-config gets updated by the package manager. However I would like my changes to be permanent and system-wide.

Ideally i'd like to have additional local configuration, something like this:

/etc/X11/xkb/keycodes/touchpadtoggle

default xkb_keycodes "touchpadtoggle" {
    <FK21> = 93;
};

/etc/X11/xorg.conf.d/touchpadtoggle.conf

Section "InputClass"
    Identifier "Touchpad Toggle Key"
    MatchIsKeyboard "on"
    MatchProduct "AT Translated"
    Option "XkbKeycodes" "+touchpadtoggle"
EndSection

This doesn't work, probably for multiple reasons:

  • Xorg does not seem to look in /etc/X11/xkb for configurations
  • The "+touchpadtoggle" syntax is probably invalid

Is this at all possible? Or is there another way to add a single key to the keymap without creating my own layout from scratch?

SnakE
  • 151
  • 5
  • @Quasímodo thanks, your solution kind of works, but with two caveats: a) It's not really persistent. E.g. any change to the KDE shortcut settings resets the map to default; and b) I need to redefine the whole xkb_keymap just to add my +touchpadtoggle keycode, meaning that large enough change to XKB can break my setup. I can accept the latter, but the former makes this solution very fragile. – SnakE Oct 09 '22 at 12:40

0 Answers0