1

If I want to redefine say R key, I use:

key <AD04>  { [         r,          R,      Page_Up,     registered ]}; 

corresponding xev output for that key is:

KeyPress event, serial 35, synthetic NO, window 0x5a00001,
    root 0x228, subw 0x0, time 96963419, (121,378), root:(992,832),
    state 0x10, keycode 27 (keysym 0x72, r), same_screen YES,
    XLookupString gives 1 bytes: (72) "r"
    XmbLookupString gives 1 bytes: (72) "r"
    XFilterEvent returns: False

How did I found AD04? I was looking into existing mappings and find r, easy.

But then there are more exotic characters, like BKSL for backspace, or LSGT which is "weird" backslash for iso keyboards (IIUC). So how did I found out LSGT? I know, that it's typically to be found on gb keyboards. Not very correct way of looking for it, but at least possible.

So now I'd like to re-define key for some multimedia-like key on MS-ergonomic 4000. The xev looks like this:

KeyRelease event, serial 39, synthetic NO, window 0x4800001,
    root 0x228, subw 0x0, time 97354466, (-387,623), root:(484,1077),
    state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

how do I find: key <XY05> or what is it? Or what can I use in place of <XY05>, similarly as we can use U200E to print arbitrary unicode if keysym is missing? This keyboard abuses F-keys higher than 12 for lost of multimedia-like keys, so I assume this will be the same and actually usable, but which!, how to find it?


update: partially found it, does not work for all keys.

Regarding symbol r:

from example, in xev listing there is keycode 27. Well I'm not that convinced, that this is indeed keycode, as showkey -k says r is 19, and it's not scancode or ascii either, and that's all codes I know about. Anyways, this whatever is 27. Pairing from whatever to <whatever> is done in: /usr/share/X11/xkb/keycodes, so issue find ./ -type f -exec grep -l 27 {} + and you will find pairing.

However some keys, in my case XF86Forward and defined duplicately in keycodes files, and neither <WHATEVER> works. Attempts to define custom xkb_keycodes ends up in errors (xkb is not that well written/documented). Anywys as a ugly workaround, one can use xmodmap to redefine the key, and then use in xkb some other key, which actually works.

Martin Mucha
  • 215
  • 3
  • 11
  • Related: https://askubuntu.com/a/1200910/968501 – Raffa Jun 15 '22 at 07:36
  • @Raffa thanks. But this is doing the opposite IIUC. The hard part is finding key <KEY_CODE>. I cannot define/find it. I have keycode as reported by xev, but I don't know how to write it into xkb. In my case, it's "keycode 167", I found it defined in evdev as and in xfree86 as but neither works. No idea how to proceed. – Martin Mucha Jun 15 '22 at 12:10
  • opposite, apologies ... kindly see this: https://askubuntu.com/a/1313977/968501 – Raffa Jun 15 '22 at 15:27

0 Answers0