4

I got new thinkpad and it's missing a ContextMenu key and has PrintScreen key where ContextMenu should have been. I remapped it using xmodmap.

The problem is, the key is missing KeyPress events, only KeyRelease events are there. I figured out the keycode is 107 and ran

xmodmap -e "keycode 107 = Menu NoSymbol Menu"

If I press ContextMenu ... ehm ... PrintScreen, this gets generated as seen by xev:

KeymapNotify event, serial 40, synthetic NO, window 0x0,
keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   8   0   0   
       0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyRelease event, serial 40, synthetic NO, window 0x4c00001,
root 0xb8, subw 0x0, time 19723366, (753,710), root:(761,752),
state 0x10, keycode 107 (keysym 0xff67, Menu), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

As you can see, the KeyPress is missing and KeyRelease, in its loneliness, is correctly announcing "Menu". It's not entirely broken: when I press Super+PrintScreen, the KeyPress is magically there:

KeyPress event, serial 40, synthetic NO, window 0x4c00001,
root 0xb8, subw 0x0, time 19800199, (462,314), root:(470,356),
state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x4c00001,
root 0xb8, subw 0x0, time 19800349, (462,314), root:(470,356),
state 0x50, keycode 107 (keysym 0xff67, Menu), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4c00001,
root 0xb8, subw 0x0, time 19800408, (462,314), root:(470,356),
state 0x50, keycode 107 (keysym 0xff67, Menu), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4c00001,
root 0xb8, subw 0x0, time 19800541, (462,314), root:(470,356),
state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

It's usable now, but it's not yet perfect.
Has anybody seen my KeyPress? Where did it go?

  • It's possible that something has grabbed the key, although I thought that would also grab the KeyRelease event. It's also possible that the keyboard acts weirdly — some keyboards are a bit peculiar with the PrintScreen and Pause keys. Switch to a text console (Ctrl+Alt+F1), log in and run showkey. Press the key, do you see both press and release events or just release? – Gilles Apr 25 '15 at 12:25
  • @Gilles yup, showkey shows both press and release, but the key number is 99 in showkey, unlike the 107 in xev. – enrey Apr 25 '15 at 12:48
  • The different numbers are ok: Xorg uses a keycode numbering with an offset from the hardware, Linux uses the hardware value. – Gilles Apr 25 '15 at 12:57
  • What is your system keyboard configuration? (E.g. language, options) – Gilles Apr 25 '15 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.