Is it possible to remap the Back/Forward keys of a Thinkpad USB keyboard on Linux?
On my Thinkpad laptop I can easily change the Back/Forward keys to something else (I usually map them to PageDown/PageUp), as they have their own keycode (166 and 167):
xmodmap -e 'keycode 166=Prior'
xmodmap -e 'keycode 167=Next'
However, on my Thinkpad USB keyboard, the Back/Forward keys seem to be hard-mapped to Alt+Left and Alt+Right, respectively, so I cannot use xmodmap to remap them. Is there any other way I can remap them? I've already tried xautomation, but that didn't work.
This is what 'xev' shows me when I press the Forward key:
KeyPress event, serial 36, synthetic NO, window 0x4e00001,
root 0xb4, subw 0x0, time 65023191, (16,-20), root:(641,33),
state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x4e00001,
root 0xb4, subw 0x0, time 65023191, (16,-20), root:(641,33),
state 0x8, keycode 114 (keysym 0xff53, Right), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x4e00001,
root 0xb4, subw 0x0, time 65023271, (16,-20), root:(641,33),
state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x4e00001,
root 0xb4, subw 0x0, time 65023271, (16,-20), root:(641,33),
state 0x0, keycode 114 (keysym 0xff53, Right), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
I put this in my .bashrc:
# this maps the previous and next page buttons to pgup and pgdown
xmodmap -e "keycode 167 = Next"
xmodmap -e "keycode 166 = Prior"
works great, but doesn't seem to cut it in virtualbox 6 for some reason.